From 5238c641492f9fd7dc8e7b9d3a2612dd0bad9c56 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Thu, 28 Mar 2024 11:28:29 -0700 Subject: [PATCH] ci: hotfix: slash command token, add error comment. --- .github/workflows/slash_command_dispatch.yml | 15 ++++++++++++++- .github/workflows/test-pr-command.yml | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/slash_command_dispatch.yml b/.github/workflows/slash_command_dispatch.yml index 6ac90463..af2db36c 100644 --- a/.github/workflows/slash_command_dispatch.yml +++ b/.github/workflows/slash_command_dispatch.yml @@ -9,19 +9,32 @@ env: jobs: slashCommandDispatch: + # Only allow slash commands on pull request (not on issues) + if: ${{ github.event.issue.pull_request }} runs-on: ubuntu-latest steps: + - name: Slash Command Dispatch + id: dispatch uses: peter-evans/slash-command-dispatch@v4 with: repository: ${{ github.repository }} - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} issue-type: pull-request commands: | autofix test-pr static-args: | pr=${{ github.event.issue.number }} + comment-id=${{ github.event.comment.id }} # Only run for users with 'write' permission on the main repository permission: write + + - name: Edit comment with error message + if: steps.dispatch.outputs.error-message + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ github.event.comment.id }} + body: | + > Error: ${{ steps.dispatch.outputs.error-message }} diff --git a/.github/workflows/test-pr-command.yml b/.github/workflows/test-pr-command.yml index 2e2c6815..169aab71 100644 --- a/.github/workflows/test-pr-command.yml +++ b/.github/workflows/test-pr-command.yml @@ -7,6 +7,10 @@ on: description: 'PR Number' type: number required: true + comment-id: + description: 'Comment ID (Optional)' + type: string + required: false env: AIRBYTE_ANALYTICS_ID: ${{ vars.AIRBYTE_ANALYTICS_ID }}