From 55850a8b444c0b3f45aa57b3780f8b7af7580eeb Mon Sep 17 00:00:00 2001 From: Ed Savage Date: Mon, 9 Mar 2026 12:23:46 +1300 Subject: [PATCH] test: add workflow dispatch to test self-approval Made-with: Cursor --- .github/workflows/test-self-approve.yml | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/test-self-approve.yml diff --git a/.github/workflows/test-self-approve.yml b/.github/workflows/test-self-approve.yml new file mode 100644 index 000000000..26d334b7d --- /dev/null +++ b/.github/workflows/test-self-approve.yml @@ -0,0 +1,27 @@ +name: Test self-approve + +on: + workflow_dispatch: + inputs: + pr_number: + description: "PR number to try approving" + required: true + +permissions: + pull-requests: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Try to approve PR using GITHUB_TOKEN + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "Attempting to approve PR #${{ inputs.pr_number }} using GITHUB_TOKEN (github-actions[bot])" + echo "Checking PR author..." + gh pr view ${{ inputs.pr_number }} --repo ${{ github.repository }} --json author --jq '.author.login' + echo "Attempting approval..." + gh pr review ${{ inputs.pr_number }} --repo ${{ github.repository }} --approve \ + --body "Test: auto-approval using GITHUB_TOKEN" 2>&1 || echo "APPROVAL FAILED" + echo "Done."