Skip to content

Commit c29bd0b

Browse files
author
Jeremy Udit
committed
Adds launching tests from labels
1 parent 99e2f0d commit c29bd0b

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed
Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
11
name: Acceptance Tests
22

3+
34
on:
5+
pull_request:
6+
types: [labeled]
47
issue_comment:
58
types: [created]
69

710
jobs:
811
acceptance-tests:
912
runs-on: ubuntu-latest
1013
steps:
11-
- name: Match /run-acceptance-tests prefix
12-
id: match_prefix
13-
uses: jcudit/[email protected]
14-
with:
15-
prefix: '/run-acceptance-tests'
1614

17-
- name: Acknowledge on calling Issue
18-
uses: octokit/[email protected]
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+
)
2623
27-
- name: Parse Arguments From Comment Body
24+
- name: Parse Arguments From Label Body
2825
run: |
2926
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
3228
)
3329
3430
- name: Checkout
3531
uses: actions/[email protected]
3632
with:
37-
ref: ${{ env.GITHUB_SHA }}
33+
ref: ${{ env.HEAD_SHA }}
3834

3935
- name: Generate Test Fixtures
4036
run: |
@@ -53,13 +49,3 @@ jobs:
5349
GITHUB_TEST_COLLABORATOR_TOKEN: ${{ secrets.GITHUB_TEST_COLLABORATOR_TOKEN }}
5450
GITHUB_TEMPLATE_REPOSITORY: terraform-template-module
5551
GITHUB_TEMPLATE_REPOSITORY_RELEASE_ID: 23826477
56-
57-
- name: Report Results To Calling Issue
58-
if: always()
59-
uses: octokit/[email protected]
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

Comments
 (0)