|
1 | 1 | name: Acceptance Tests |
2 | 2 |
|
| 3 | + |
3 | 4 | on: |
| 5 | + pull_request: |
| 6 | + types: [labeled] |
4 | 7 | issue_comment: |
5 | 8 | types: [created] |
6 | 9 |
|
7 | 10 | jobs: |
8 | 11 | acceptance-tests: |
9 | 12 | runs-on: ubuntu-latest |
10 | 13 | steps: |
11 | | - - name: Match /run-acceptance-tests prefix |
12 | | - id: match_prefix |
13 | | - |
14 | | - with: |
15 | | - prefix: '/run-acceptance-tests' |
16 | 14 |
|
17 | | - - name: Acknowledge on calling Issue |
18 | | - |
19 | | - with: |
20 | | - route: POST /repos/:owner/:repo/issues/${{ steps.match_prefix.outputs.issue_number }}/comments |
21 | | - body: | |
22 | | - 👋 @${{ steps.match_prefix.outputs.issue_actor }} - Starting Action. |
23 | | - Follow along on the [Actions tab](${{ steps.match_prefix.outputs.actions_url }}). |
24 | | - env: |
25 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 15 | + - name: Store required context in environment |
| 16 | + run: | |
| 17 | + echo ::set-env name=HEAD_SHA::$( |
| 18 | + jq -rc '.pull_request.head.sha' $GITHUB_EVENT_PATH |
| 19 | + ) |
| 20 | + echo ::set-env name=PULL_NUMBER::$( |
| 21 | + jq -rc .pull.number $GITHUB_EVENT_PATH |
| 22 | + ) |
26 | 23 |
|
27 | | - - name: Parse Arguments From Comment Body |
| 24 | + - name: Parse Arguments From Label Body |
28 | 25 | run: | |
29 | 26 | echo ::set-env name=RUN_FILTER::$( |
30 | | - echo "${{ steps.match_prefix.outputs.comment_body }}" | \ |
31 | | - cut -d ' ' -f 2 |
| 27 | + jq -rc '.pull_request.head.sha' $GITHUB_EVENT_PATH |
32 | 28 | ) |
33 | 29 |
|
34 | 30 | - name: Checkout |
35 | 31 | |
36 | 32 | with: |
37 | | - ref: ${{ env.GITHUB_SHA }} |
| 33 | + ref: ${{ env.HEAD_SHA }} |
38 | 34 |
|
39 | 35 | - name: Generate Test Fixtures |
40 | 36 | run: | |
|
53 | 49 | GITHUB_TEST_COLLABORATOR_TOKEN: ${{ secrets.GITHUB_TEST_COLLABORATOR_TOKEN }} |
54 | 50 | GITHUB_TEMPLATE_REPOSITORY: terraform-template-module |
55 | 51 | GITHUB_TEMPLATE_REPOSITORY_RELEASE_ID: 23826477 |
56 | | - |
57 | | - - name: Report Results To Calling Issue |
58 | | - if: always() |
59 | | - |
60 | | - with: |
61 | | - route: POST /repos/:owner/:repo/issues/${{ steps.match_prefix.outputs.issue_number }}/comments |
62 | | - body: | |
63 | | - 👋 @${{ steps.match_prefix.outputs.issue_actor }} - Action Complete. |
64 | | - env: |
65 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments