Skip to content

Commit 03559e6

Browse files
authored
allow /e2e in PRs to run e2e workflow (#462)
Signed-off-by: Manabu McCloskey <[email protected]>
1 parent 98b7234 commit 03559e6

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/e2e.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,39 @@ on:
88
- '**.go'
99
- 'go.sum'
1010
- 'go.mod'
11+
repository_dispatch:
12+
types: [e2e-command]
13+
1114
jobs:
1215
e2e:
1316
runs-on: ubuntu-22.04
17+
if: ${{ github.event.ref != '' }}
18+
steps:
19+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
20+
with:
21+
fetch-depth: 0
22+
- name: Setup Go
23+
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
24+
with:
25+
go-version: '1.22'
26+
- name: Run tests
27+
run: |
28+
make e2e
29+
# invoked by slash command workflow
30+
e2e-slash-command:
31+
runs-on: ubuntu-22.04
32+
if: ${{ github.event.action == 'e2e-command' }}
1433
steps:
1534
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
35+
with:
36+
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
37+
ref: ${{ github.event.client_payload.pull_request.head.ref }}
38+
fetch-depth: 0
1639
- name: Setup Go
1740
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
1841
with:
1942
go-version: '1.22'
2043
- name: Run tests
2144
run: |
2245
make e2e
46+

.github/workflows/slash-commands.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: slash-commands
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
slash_command_dispatch:
9+
runs-on: ubuntu-22.04
10+
steps:
11+
- name: Generate a token
12+
id: generate-token
13+
uses: actions/create-github-app-token@v1
14+
with:
15+
app-id: ${{ vars.CNOE_GH_WORKFLOW_TOKEN_APP_ID }}
16+
private-key: ${{ secrets.CNOE_GH_WORKFLOW_TOKEN_PRIVATE_KEY }}
17+
- name: Slash Command Dispatch
18+
uses: peter-evans/slash-command-dispatch@v4
19+
with:
20+
token: ${{ steps.generate-token.outputs.token }}
21+
commands: |
22+
e2e
23+
permission: write
24+
issue-type: pull-request

0 commit comments

Comments
 (0)