feat: add cancellation handler for slash command comments #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Slash Command Dispatch | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
slashCommandDispatch: | |
name: Dispatch | |
runs-on: ubuntu-24.04 | |
steps: | |
# Use pre-made action (handles private repo auth): | |
- name: Get PR Info | |
if: ${{ github.event.issue.pull_request }} | |
id: pr-info | |
uses: cloudposse-github-actions/[email protected] | |
with: | |
id: ${{ github.event.issue.number }} | |
- name: Slash Command Dispatch (Workflow) | |
id: scd | |
uses: peter-evans/slash-command-dispatch@v3 | |
with: | |
token: ${{ github.token }} | |
permission: write | |
dispatch-type: workflow | |
issue-type: both | |
commands: | | |
test | |
static-args: | | |
repo=${{ fromJSON(steps.pr-info.outputs.json).head.repo.full_name || github.repository }} | |
gitref=${{ fromJSON(steps.pr-info.outputs.json).head.ref }} | |
comment-id=${{ github.event.comment.id }} | |
pr=${{ github.event.issue.pull_request != null && github.event.issue.number || '' }} | |
- name: Edit comment with error message | |
if: steps.scd.outputs.error-message | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
comment-id: ${{ github.event.comment.id }} | |
body: | | |
> Error: ${{ steps.scd.outputs.error-message }} |