From 3cf3f4ecf2a138fea606fbcf0eaf363822278251 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 20:08:06 -0700 Subject: [PATCH 01/14] add custom messages support --- action.yml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index cc20bfc..5c4aa9e 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,18 @@ inputs: description: "Disable auto-commit step" required: false default: "false" + start-message: + description: "Message to include in the start comment" + required: false + default: "" + success-message: + description: "Message to include in the success comment" + required: false + default: "" + failure-message: + description: "Message to include in the failure comment" + required: false + default: "" runs: using: "composite" @@ -95,11 +107,9 @@ runs: comment-id: ${{ inputs.comment-id }} issue-number: ${{ inputs.pr }} body: | - > **Running `poe ${{ steps.resolve-command.outputs.command }}`...** + > ${{ inputs.start-message || ('**Running `poe' + steps.resolve-command.outputs.command + '`...**') }} > - > [Link to job logs.][1] - > - > [1]: ${{ steps.vars.outputs.run-url }} + > [Link to job logs.](${{ steps.vars.outputs.run-url }}) - name: Checkout PR if: inputs.pr @@ -202,18 +212,17 @@ runs: comment-id: ${{ steps.comment-start.outputs.comment-id }} reactions: hooray body: > - ✅ Poe command `${{ steps.resolve-command.outputs.command }}` completed successfully. (${{ steps.auto-commit.outputs.commit_hash }}) + 🤖 Auto-commit successful: ${{ steps.auto-commit.outputs.commit_hash }} - name: Append no-op comment if: > steps.comment-start.outputs.comment-id - && steps.auto-commit.outputs.changes_detected != 'true' uses: peter-evans/create-or-update-comment@v4 with: comment-id: ${{ steps.comment-start.outputs.comment-id }} reactions: "+1" - body: > - 🟦 Poe command `${{ steps.resolve-command.outputs.command }}` completed successfully. + body: | + ${{ inputs.success-message || (' 🟦 Poe command `' + steps.resolve-command.outputs.command + '` completed successfully.') }} - name: Append failure comment if: failure() && steps.comment-start.outputs.comment-id @@ -222,7 +231,7 @@ runs: comment-id: ${{ steps.comment-start.outputs.comment-id }} reactions: confused body: > - ❌ Poe command `${{ steps.resolve-command.outputs.command }}` failed. Please inspect the logs. + ${{ inputs.failure-message || ('❌ Poe command `' + steps.resolve-command.outputs.command + '` failed. Please inspect the logs.') }} # Create a new PR if no PR was provided From b0124e85a67c88f50f1a38f7ee0fa4c42a1adb3b Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 20:20:30 -0700 Subject: [PATCH 02/14] add slash command dispatch --- .github/workflows/slash-command-dispatch.yml | 43 ++++++++++++++++++++ poe_tasks.toml | 3 ++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/slash-command-dispatch.yml create mode 100644 poe_tasks.toml diff --git a/.github/workflows/slash-command-dispatch.yml b/.github/workflows/slash-command-dispatch.yml new file mode 100644 index 0000000..04e7330 --- /dev/null +++ b/.github/workflows/slash-command-dispatch.yml @@ -0,0 +1,43 @@ +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/get-pr@v2.0.0 + with: + id: ${{ github.event.issue.number }} + + - name: Slash Command Dispatch (Workflow) + id: scd + uses: peter-evans/slash-command-dispatch@v3 + with: + token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} + permission: write + dispatch-type: workflow + issue-type: both + + commands: | + test + test-fail + + 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 }} diff --git a/poe_tasks.toml b/poe_tasks.toml new file mode 100644 index 0000000..e45f383 --- /dev/null +++ b/poe_tasks.toml @@ -0,0 +1,3 @@ +[tasks] +test = "echo 'Dummy tests...'" +test-fail = "exit 1" From ff00102ab67ca0949b1e5b1cacba2ff0ff59cf2c Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 20:28:35 -0700 Subject: [PATCH 03/14] add slash command --- .github/workflows/slash-command-dispatch.yml | 1 - .github/workflows/tests-command.yml | 40 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests-command.yml diff --git a/.github/workflows/slash-command-dispatch.yml b/.github/workflows/slash-command-dispatch.yml index 04e7330..241e6c8 100644 --- a/.github/workflows/slash-command-dispatch.yml +++ b/.github/workflows/slash-command-dispatch.yml @@ -26,7 +26,6 @@ jobs: commands: | test - test-fail static-args: | repo=${{ fromJSON(steps.pr-info.outputs.json).head.repo.full_name || github.repository }} diff --git a/.github/workflows/tests-command.yml b/.github/workflows/tests-command.yml new file mode 100644 index 0000000..8835746 --- /dev/null +++ b/.github/workflows/tests-command.yml @@ -0,0 +1,40 @@ +name: Format Fix (On-Demand) + +on: + workflow_dispatch: + inputs: + # The following 4 inputs are always passed by the Slash Command Dispatch: + repo: + description: Repo Name. Ignored. + type: choice + required: false + default: airbytehq/airbyte-enterprise + options: + - airbytehq/airbyte-enterprise + gitref: + description: Git Ref. Ignored. + required: false + comment-id: + description: Comment ID. Optional. + required: false + pr: + description: PR Number. + type: number + required: false + +permissions: + contents: write + pull-requests: write + issues: write + +jobs: + run-format-fix: + runs-on: ubuntu-latest + steps: + - name: Run `poe format-fix` [Poe Command Processor] + uses: ./action.yml + with: + pr: ${{ github.event.inputs.pr }} + comment-id: ${{ github.event.inputs.comment-id }} + github-token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} + command: test From b2de568c652af8c2d0be8e8e5b4c56354f94ed5a Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 20:31:09 -0700 Subject: [PATCH 04/14] add trigger: ready-for-review --- .github/workflows/tests-command.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-command.yml b/.github/workflows/tests-command.yml index 8835746..f3bc51e 100644 --- a/.github/workflows/tests-command.yml +++ b/.github/workflows/tests-command.yml @@ -1,6 +1,8 @@ -name: Format Fix (On-Demand) +name: Test Action on: + pull_request: + types: [ready_for_review] workflow_dispatch: inputs: # The following 4 inputs are always passed by the Slash Command Dispatch: @@ -34,7 +36,7 @@ jobs: - name: Run `poe format-fix` [Poe Command Processor] uses: ./action.yml with: - pr: ${{ github.event.inputs.pr }} + pr: ${{ github.event.inputs.pr || github.event.pull_request.number }} comment-id: ${{ github.event.inputs.comment-id }} - github-token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} + github-token: ${{ github.token }} command: test From 507eac306458fca97712d5cc56a2e954e4943a9a Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 20:32:46 -0700 Subject: [PATCH 05/14] retry relative path --- .github/workflows/tests-command.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-command.yml b/.github/workflows/tests-command.yml index f3bc51e..eb808c7 100644 --- a/.github/workflows/tests-command.yml +++ b/.github/workflows/tests-command.yml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Run `poe format-fix` [Poe Command Processor] - uses: ./action.yml + uses: ./ with: pr: ${{ github.event.inputs.pr || github.event.pull_request.number }} comment-id: ${{ github.event.inputs.comment-id }} From 43728b3b83461a0d29fe3d61ec355c9ca536f126 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 20:33:45 -0700 Subject: [PATCH 06/14] add checkout --- .github/workflows/tests-command.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/tests-command.yml b/.github/workflows/tests-command.yml index eb808c7..04a1900 100644 --- a/.github/workflows/tests-command.yml +++ b/.github/workflows/tests-command.yml @@ -33,6 +33,11 @@ jobs: run-format-fix: runs-on: ubuntu-latest steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: Run `poe format-fix` [Poe Command Processor] uses: ./ with: From d5ffdd2e6be83153e6727799541a620579edf680 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 20:37:04 -0700 Subject: [PATCH 07/14] try with format command --- action.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 5c4aa9e..deceea2 100644 --- a/action.yml +++ b/action.yml @@ -222,7 +222,10 @@ runs: comment-id: ${{ steps.comment-start.outputs.comment-id }} reactions: "+1" body: | - ${{ inputs.success-message || (' 🟦 Poe command `' + steps.resolve-command.outputs.command + '` completed successfully.') }} + ${{ inputs.success-message || format( + ' 🟦 Poe command `{0}` completed successfully.', + steps.resolve-command.outputs.command + ) }} - name: Append failure comment if: failure() && steps.comment-start.outputs.comment-id @@ -231,7 +234,10 @@ runs: comment-id: ${{ steps.comment-start.outputs.comment-id }} reactions: confused body: > - ${{ inputs.failure-message || ('❌ Poe command `' + steps.resolve-command.outputs.command + '` failed. Please inspect the logs.') }} + ${{ inputs.failure-message || format( + '❌ Poe command `{0}` failed. Please inspect the logs.', + steps.resolve-command.outputs.command + ) }} # Create a new PR if no PR was provided @@ -251,9 +257,8 @@ runs: It contains the output of the command `${{ steps.resolve-command.outputs.command }}`. Please review the changes and consider merging them if they are acceptable. - [Link to job logs.][1] + [Link to job logs.](${{ steps.vars.outputs.run-url }}) - [1]: ${{ steps.vars.outputs.run-url }} branch: auto-commit/poe-processor-${{ github.run_id }} draft: true commit-user-name: Octavia Squidington III From d7ce47ea47d9fb699d7e533ba93e7c6a2cdd2cec Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 21:52:54 -0700 Subject: [PATCH 08/14] retry without line breaks --- action.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index deceea2..f4a4851 100644 --- a/action.yml +++ b/action.yml @@ -222,10 +222,7 @@ runs: comment-id: ${{ steps.comment-start.outputs.comment-id }} reactions: "+1" body: | - ${{ inputs.success-message || format( - ' 🟦 Poe command `{0}` completed successfully.', - steps.resolve-command.outputs.command - ) }} + ${{ inputs.success-message || format(' 🟦 Poe command `{0}` completed successfully.', steps.resolve-command.outputs.command) }} - name: Append failure comment if: failure() && steps.comment-start.outputs.comment-id @@ -234,10 +231,7 @@ runs: comment-id: ${{ steps.comment-start.outputs.comment-id }} reactions: confused body: > - ${{ inputs.failure-message || format( - '❌ Poe command `{0}` failed. Please inspect the logs.', - steps.resolve-command.outputs.command - ) }} + ${{ inputs.failure-message || format('❌ Poe command `{0}` failed. Please inspect the logs.', steps.resolve-command.outputs.command) }} # Create a new PR if no PR was provided From c3329350f6c642f7cb312c895de2cb5d781f50d1 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 21:55:20 -0700 Subject: [PATCH 09/14] fix other instance of concatenation --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index f4a4851..a87b1b7 100644 --- a/action.yml +++ b/action.yml @@ -107,7 +107,7 @@ runs: comment-id: ${{ inputs.comment-id }} issue-number: ${{ inputs.pr }} body: | - > ${{ inputs.start-message || ('**Running `poe' + steps.resolve-command.outputs.command + '`...**') }} + > ${{ inputs.start-message || format('**Running `poe {0}`...**', steps.resolve-command.outputs.command) }} > > [Link to job logs.](${{ steps.vars.outputs.run-url }}) From 147656bcf0c876cf0cf5b43a546e4d47399c50fa Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 21:57:35 -0700 Subject: [PATCH 10/14] add space --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index a87b1b7..b24beec 100644 --- a/action.yml +++ b/action.yml @@ -110,6 +110,7 @@ runs: > ${{ inputs.start-message || format('**Running `poe {0}`...**', steps.resolve-command.outputs.command) }} > > [Link to job logs.](${{ steps.vars.outputs.run-url }}) + > - name: Checkout PR if: inputs.pr From 7e6ca3de75d1c72a705712135ca9c368dcc5848b Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 21:59:07 -0700 Subject: [PATCH 11/14] add more test inputs --- action.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index b24beec..718ae3c 100644 --- a/action.yml +++ b/action.yml @@ -26,11 +26,17 @@ inputs: start-message: description: "Message to include in the start comment" required: false - default: "" + default: | + **Let's go!** + + I hope this works! success-message: description: "Message to include in the success comment" required: false - default: "" + default: | + Everything went great! + + I'm super happy about it. failure-message: description: "Message to include in the failure comment" required: false From a381c5c696bca1f04eff95d4664046dabfc8b653 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 22:01:54 -0700 Subject: [PATCH 12/14] add back quote marks --- action.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index 718ae3c..e0fa450 100644 --- a/action.yml +++ b/action.yml @@ -26,17 +26,11 @@ inputs: start-message: description: "Message to include in the start comment" required: false - default: | - **Let's go!** - - I hope this works! + default: "" success-message: description: "Message to include in the success comment" required: false - default: | - Everything went great! - - I'm super happy about it. + default: "" failure-message: description: "Message to include in the failure comment" required: false @@ -229,7 +223,7 @@ runs: comment-id: ${{ steps.comment-start.outputs.comment-id }} reactions: "+1" body: | - ${{ inputs.success-message || format(' 🟦 Poe command `{0}` completed successfully.', steps.resolve-command.outputs.command) }} + > ${{ inputs.success-message || format(' 🟦 Poe command `{0}` completed successfully.', steps.resolve-command.outputs.command) }} - name: Append failure comment if: failure() && steps.comment-start.outputs.comment-id From 9fb9b2998ed4a0f2cea253fe47711cfd97244c6b Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 22:03:57 -0700 Subject: [PATCH 13/14] fix step name --- .github/workflows/tests-command.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-command.yml b/.github/workflows/tests-command.yml index 04a1900..5628588 100644 --- a/.github/workflows/tests-command.yml +++ b/.github/workflows/tests-command.yml @@ -38,7 +38,7 @@ jobs: with: fetch-depth: 1 - - name: Run `poe format-fix` [Poe Command Processor] + - name: Run `poe test` [Poe Command Processor] uses: ./ with: pr: ${{ github.event.inputs.pr || github.event.pull_request.number }} From f28eb2a8ec54c0ccbb80d6e9538e3f6279e2be33 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 18 Jun 2025 22:05:10 -0700 Subject: [PATCH 14/14] fix token ref --- .github/workflows/slash-command-dispatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/slash-command-dispatch.yml b/.github/workflows/slash-command-dispatch.yml index 241e6c8..763c2ac 100644 --- a/.github/workflows/slash-command-dispatch.yml +++ b/.github/workflows/slash-command-dispatch.yml @@ -19,7 +19,7 @@ jobs: id: scd uses: peter-evans/slash-command-dispatch@v3 with: - token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }} + token: ${{ github.token }} permission: write dispatch-type: workflow issue-type: both