-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.flow
More file actions
74 lines (71 loc) · 2.46 KB
/
github.flow
File metadata and controls
74 lines (71 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# yaml-language-server: $schema=https://flowexec.io/schemas/flowfile_schema.json
namespace: github
description: |
Interact with the GitHub REST API using flow's request executable. All
endpoints used here are public and require no authentication. Add a
secretRef for GITHUB_TOKEN when hitting authenticated endpoints.
tags:
- api
- github
executables:
- verb: get
name: repo
description: |
Fetch public metadata for any GitHub repository. Pass owner and repo
name as positional arguments: `flow get repo <owner> <repo>`
exec:
args:
- envKey: OWNER
pos: 1
- envKey: REPO
pos: 2
cmd: |
curl -sf "https://api.github.com/repos/${OWNER}/${REPO}" \
| jq '{
name,
description,
stars: .stargazers_count,
forks: .forks_count,
language,
open_issues: .open_issues_count,
updated_at
}'
- verb: get
name: releases
description: |
List the latest releases for the flow project using the request
executable type. `transformResponse` extracts the fields we care about.
request:
url: https://api.github.com/repos/flowexec/flow/releases
logResponse: true
headers:
Accept: application/vnd.github+json
transformResponse: 'join(map(fromJSON(body), string(#["tag_name"]) + " — " + string(#["name"]) + " (" + string(#["published_at"]) + ")"), "\n")'
- verb: check
name: rate-limit
description: |
Check the current GitHub API rate limit status. Useful for debugging
pipelines that make many API calls.
request:
url: https://api.github.com/rate_limit
headers:
Accept: application/vnd.github+json
logResponse: true
transformResponse: fromJSON(body)["rate"]
- verb: send
name: webhook
description: |
POST a JSON event payload to a webhook endpoint with status validation.
A common pattern for triggering CI, chat notifications, or custom
integrations from any serial pipeline step. Combine with `retries` in a
serial ref to automatically retry on transient failures.
request:
url: https://httpbin.org/post
method: POST
headers:
Content-Type: application/json
X-Source: flow-examples
body: '{"event": "deploy", "status": "success", "version": "1.0.0"}'
validStatusCodes:
- 200
transformResponse: fromJSON(body)["json"]