|
12 | 12 | steps: |
13 | 13 | - name: Slash Command Dispatch |
14 | 14 | id: dispatch |
15 | | - uses: peter-evans/slash-command-dispatch@v4 |
| 15 | + # TODO: Revert to `peter-evans/slash-command-dispatch@v4` after PR merges: |
| 16 | + # - https://github.com/peter-evans/slash-command-dispatch/pull/372/files |
| 17 | + uses: aaronsteers/slash-command-dispatch@aj/fix/add-dispatched-bool-output |
16 | 18 | with: |
17 | 19 | repository: ${{ github.repository }} |
18 | 20 | token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} |
|
36 | 38 | comment-id: ${{ github.event.comment.id }} |
37 | 39 | body: | |
38 | 40 | > Error: ${{ steps.dispatch.outputs.error-message }} |
| 41 | +
|
| 42 | + - name: Generate help text |
| 43 | + id: help |
| 44 | + if: > |
| 45 | + startsWith(github.event.comment.body, '/') && |
| 46 | + !steps.dispatch.outputs.dispatched |
| 47 | + run: | |
| 48 | + HELP_TEXT="The following slash commands are available: |
| 49 | +
|
| 50 | + - \`/autofix\` - Corrects any linting or formatting issues |
| 51 | + - \`/test\` - Runs the test suite |
| 52 | + - \`/poetry-lock\` - Re-locks dependencies and updates the poetry.lock file |
| 53 | + - \`/help\` - Shows this help message" |
| 54 | + |
| 55 | + if [[ "${{ github.event.comment.body }}" == "/help" ]]; then |
| 56 | + echo "body=$HELP_TEXT" >> $GITHUB_OUTPUT |
| 57 | + else |
| 58 | + echo "body=It looks like you are trying to enter a slash command. Either the slash command is unrecognized or you don't have access to call it. |
| 59 | +
|
| 60 | + $HELP_TEXT" >> $GITHUB_OUTPUT |
| 61 | + fi |
| 62 | +
|
| 63 | + - name: Post help message |
| 64 | + if: > |
| 65 | + startsWith(github.event.comment.body, '/') && |
| 66 | + !steps.dispatch.outputs.dispatched |
| 67 | + uses: peter-evans/create-or-update-comment@v4 |
| 68 | + with: |
| 69 | + comment-id: ${{ github.event.comment.id }} |
| 70 | + body: ${{ steps.help.outputs.body }} |
0 commit comments