Skip to content

Commit 1569943

Browse files
ci: add slash command dispatch workflow
Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent c6ab4a2 commit 1569943

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Slash Command Dispatch
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
permissions:
8+
contents: read
9+
issues: write
10+
pull-requests: write
11+
actions: write
12+
13+
jobs:
14+
slashCommandDispatch:
15+
# Only allow slash commands on pull request (not on issues)
16+
if: ${{ github.event.issue.pull_request }}
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Authenticate as GitHub App
20+
uses: actions/create-github-app-token@v2
21+
id: get-app-token
22+
with:
23+
app-id: ${{ secrets.OCTAVIA_BOT_APP_ID }}
24+
private-key: ${{ secrets.OCTAVIA_BOT_PRIVATE_KEY }}
25+
26+
- name: Slash Command Dispatch
27+
id: dispatch
28+
uses: peter-evans/slash-command-dispatch@v5
29+
with:
30+
repository: ${{ github.repository }}
31+
token: ${{ steps.get-app-token.outputs.token }}
32+
dispatch-type: workflow
33+
issue-type: pull-request
34+
commands: |
35+
terraform-examples
36+
static-args: |
37+
pr=${{ github.event.issue.number }}
38+
comment-id=${{ github.event.comment.id }}
39+
40+
# Only run for users with 'write' permission on the main repository
41+
permission: write
42+
43+
- name: Edit comment with error message
44+
if: steps.dispatch.outputs.error-message
45+
uses: peter-evans/create-or-update-comment@v5
46+
with:
47+
comment-id: ${{ github.event.comment.id }}
48+
body: |
49+
> Error: ${{ steps.dispatch.outputs.error-message }}

0 commit comments

Comments
 (0)