Skip to content

Commit 9c3a50e

Browse files
committed
update readme
1 parent c94138b commit 9c3a50e

File tree

2 files changed

+69
-3
lines changed

2 files changed

+69
-3
lines changed

.github/workflows/comment.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: build
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
if: >
10+
startsWith(github.event.comment.body, 'build')
11+
&& startsWith(github.event.issue.pull_request.url, 'https://')
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: print comment body
17+
run: echo ${{ github.event.comment.body }}
18+
19+
- name: set body comments
20+
run: |
21+
set -eu
22+
build_dir=$( cut -d ' ' -f 2 <<< '${{ github.event.comment.body }}' )
23+
buckets=$( cut -d ' ' -f 3- <<< "${{ github.event.comment.body }}" )
24+
echo $build_dir
25+
echo $buckets
26+
27+
- name: 'Load PR Details'
28+
id: load-pr
29+
run: |
30+
set -eu
31+
resp=$(curl -sSf \
32+
--url ${{ github.event.issue.pull_request.url }} \
33+
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
34+
--header 'content-type: application/json')
35+
echo $resp
36+
sha=$(jq -r '.head.sha' <<< "$resp")
37+
echo "::set-output name=head_sha::$sha"
38+
# comments_url=$(jq -r '.comments_url' <<< "$resp")
39+
# echo "::set-output name=comments_url::$comments_url"
40+
# branch=$(jq -r '.branch' <<< "$resp")
41+
# echo "::set-output name=comments_url::$comments_url"
42+
43+
# - uses: actions/checkout@v2
44+
# with:
45+
# ref: ${{ github.event.client_payload.ref }}
46+
47+
# - name: cat repo file
48+
# run: cat output.txt
49+
# working-directory: ${{ github.event.client_payload.project }}

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Execute a github workflow manually
22

3+
Below are several examples for how to kick off workflow jobs manually via curl (or any external event)
4+
35
## Create workflow at .github/workflows/file.yml
46

57
Notice the `event_type` [matches](https://github.com/drewmullen/actions-playground/blob/fd3721ba3c8350995a77c570fbf3a0e0fb1c2724/.github/workflows/external_echo.yml#L5) the workflow field: `on.repository_dispatch.types`. the workflow file name does not need to match.
68

7-
## To Execute
9+
## Execute a basic job
810

911
```bash
1012
$ curl -XPOST -u "drewmullen" \
@@ -18,7 +20,7 @@ Enter host password for user 'drewmullen': <YOUR PAT>
1820

1921
## Specify a branch
2022

21-
`repository_dispatch` always uses master branch. To use another branch, view [this workflow](https://github.com/drewmullen/actions-playground/blob/fd3721ba3c8350995a77c570fbf3a0e0fb1c2724/.github/workflows/repo_dispatch.yml) and set `client_payload.ref`:
23+
`repository_dispatch` always uses master branch. To use another branch, view [this workflow](https://github.com/drewmullen/actions-playground/blob/master/.github/workflows/repo_dispatch.yml) and set `client_payload.ref`:
2224

2325
```bash
2426
curl -XPOST -u "drewmullen" \
@@ -32,7 +34,7 @@ curl -XPOST -u "drewmullen" \
3234

3335
## Condition steps to run based on input
3436

35-
If you'd like the same event to kick of specific jobs, use the `if` [condition](https://github.com/drewmullen/actions-playground/blob/fd3721ba3c8350995a77c570fbf3a0e0fb1c2724/.github/workflows/multi_repo_dispatch.yml).
37+
If you'd like the same event to kick of specific jobs, use the `if` [condition](https://github.com/drewmullen/actions-playground/blob/master/.github/workflows/multi_repo_dispatch.yml).
3638

3739
```bash
3840
curl -XPOST -u "drewmullen" \
@@ -44,6 +46,21 @@ curl -XPOST -u "drewmullen" \
4446

4547
[Example CI Output](https://github.com/drewmullen/actions-playground/runs/536598658?check_suite_focus=true)
4648

49+
50+
## Multiple dirs, same step
51+
52+
[multi_single_step.yml](https://github.com/drewmullen/actions-playground/blob/master/.github/workflows/multi_single_step.yml)
53+
54+
[Example CI Output](https://github.com/drewmullen/actions-playground/runs/536824189?check_suite_focus=true)
55+
56+
57+
## Run from a container
58+
59+
[container.yml](https://github.com/drewmullen/actions-playground/blob/master/.github/workflows/container.yml)
60+
61+
[Example CI Output](https://github.com/drewmullen/actions-playground/runs/536598658?check_suite_focus=true)
62+
63+
4764
## Create a PAT
4865

4966
https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

0 commit comments

Comments
 (0)