diff --git a/.github/workflows/poe-command.yml b/.github/workflows/poe-command.yml new file mode 100644 index 000000000..e3fcaf37c --- /dev/null +++ b/.github/workflows/poe-command.yml @@ -0,0 +1,28 @@ +name: On-Demand Poe Task + +on: + workflow_dispatch: + inputs: + comment-id: + description: "Optional comment-id of the slash command. Ignore if not applicable." + required: false + pr: + description: "PR Number" + required: false + +permissions: + contents: write + pull-requests: write + +jobs: + run-poe-command: + env: + GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }} + runs-on: ubuntu-latest + steps: + - name: Run Poe Slash Command Processor + uses: aaronsteers/poe-command-processor@v1 + with: + pr: ${{ github.event.inputs.pr }} + comment-id: ${{ github.event.inputs.comment-id }} + github-token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} diff --git a/.github/workflows/slash_command_dispatch.yml b/.github/workflows/slash_command_dispatch.yml index 3d583acab..10ef9243b 100644 --- a/.github/workflows/slash_command_dispatch.yml +++ b/.github/workflows/slash_command_dispatch.yml @@ -6,8 +6,6 @@ on: jobs: slashCommandDispatch: - # Only allow slash commands on pull request (not on issues) - if: ${{ github.event.issue.pull_request }} runs-on: ubuntu-24.04 steps: - name: Slash Command Dispatch @@ -19,17 +17,25 @@ jobs: repository: ${{ github.repository }} token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} dispatch-type: workflow - issue-type: pull-request + issue-type: both + + # Only run for users with 'write' permission on the main repository + permission: write + commands: | autofix test poetry-lock + poe + + # Notes regarding static-args: + # - Slash commands can be invoked from both issues and comments. + # - If the slash command is invoked from an issue, we intentionally pass 'null' as the PR number. + # - Comment ID will always be sent, and this is sufficient to post back status updates to the originating comment. static-args: | - pr=${{ github.event.issue.number }} + pr=${{ github.event.issue.pull_request != null && 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