From e4656f693e0c128917ac4e3e11ebf5c531275109 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Thu, 24 Apr 2025 10:31:50 -0700 Subject: [PATCH 1/4] ci: add `/poe` slash command for CDK PRs and Issues --- .github/workflows/poe-command.yml | 29 ++++++++++++++++++++ .github/workflows/slash_command_dispatch.yml | 6 ++-- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/poe-command.yml diff --git a/.github/workflows/poe-command.yml b/.github/workflows/poe-command.yml new file mode 100644 index 000000000..d464fafb9 --- /dev/null +++ b/.github/workflows/poe-command.yml @@ -0,0 +1,29 @@ +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" + type: 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..efb86fc6d 100644 --- a/.github/workflows/slash_command_dispatch.yml +++ b/.github/workflows/slash_command_dispatch.yml @@ -7,7 +7,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,13 +18,14 @@ jobs: repository: ${{ github.repository }} token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} dispatch-type: workflow - issue-type: pull-request + issue-type: both commands: | autofix test poetry-lock + poe 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 From fbea642925cf13a9bd81444b9154fb8c180141ac Mon Sep 17 00:00:00 2001 From: "Aaron (\"AJ\") Steers" Date: Thu, 24 Apr 2025 11:25:07 -0700 Subject: [PATCH 2/4] add comments to workflow --- .github/workflows/slash_command_dispatch.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/slash_command_dispatch.yml b/.github/workflows/slash_command_dispatch.yml index efb86fc6d..8cadcbada 100644 --- a/.github/workflows/slash_command_dispatch.yml +++ b/.github/workflows/slash_command_dispatch.yml @@ -19,17 +19,24 @@ jobs: token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} dispatch-type: workflow 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.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 From 2dcdd811832c419fedcd176473e4a87eebce605b Mon Sep 17 00:00:00 2001 From: "Aaron (\"AJ\") Steers" Date: Thu, 24 Apr 2025 11:25:50 -0700 Subject: [PATCH 3/4] remove type declaration --- .github/workflows/poe-command.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/poe-command.yml b/.github/workflows/poe-command.yml index d464fafb9..e3fcaf37c 100644 --- a/.github/workflows/poe-command.yml +++ b/.github/workflows/poe-command.yml @@ -8,7 +8,6 @@ on: required: false pr: description: "PR Number" - type: number required: false permissions: From 4a67e088df16a730330926dbec60348bad12caf2 Mon Sep 17 00:00:00 2001 From: "Aaron (\"AJ\") Steers" Date: Thu, 24 Apr 2025 12:44:39 -0700 Subject: [PATCH 4/4] Apply suggestion --- .github/workflows/slash_command_dispatch.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/slash_command_dispatch.yml b/.github/workflows/slash_command_dispatch.yml index 8cadcbada..10ef9243b 100644 --- a/.github/workflows/slash_command_dispatch.yml +++ b/.github/workflows/slash_command_dispatch.yml @@ -6,7 +6,6 @@ on: jobs: slashCommandDispatch: - # Only allow slash commands on pull request (not on issues) runs-on: ubuntu-24.04 steps: - name: Slash Command Dispatch