From c768101980184bc671cb34e8a1dfa353d0935269 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 2 Dec 2026 13:45:06 +0100 Subject: [PATCH] maint: refresh auto-approve action * make consistent across all repos with all auto-approve actions * pull_request_target -> pull_request (improve security) * remove checkout * simplify approval + auto-merge calls * clearer documentation Relates-to: keymanapp/keyman#17015 Test-bot: skip --- ...uto-approve-and-merge-keyman-server-pr.yml | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/auto-approve-and-merge-keyman-server-pr.yml b/.github/workflows/auto-approve-and-merge-keyman-server-pr.yml index 2bc78c3..ac04bae 100644 --- a/.github/workflows/auto-approve-and-merge-keyman-server-pr.yml +++ b/.github/workflows/auto-approve-and-merge-keyman-server-pr.yml @@ -2,27 +2,30 @@ # Automatically approves and queues for merge any pull requests with a branch # name starting with auto/, that are opened by keyman-server. # + + name: Auto Approve and Merge PRs from keyman-server -on: pull_request_target +on: pull_request jobs: auto-approve: - if: github.actor == 'keyman-server' && startsWith(github.head_ref, 'auto/') + # This test is here for safety, to prevent us accidentally approving and + # merging pull requests which don't meet our automatic merge requirements. + # + # Important: this test does not provide security; security is provided by + # GitHub as secrets are not available to forks. A PR from a fork can delete + # this test and the action will run, but without a valid GH_TOKEN it won't + # succeed. + if: github.event.pull_request.head.repo.owner.login == 'keymanapp' && github.actor == 'keyman-server' && startsWith(github.head_ref, 'auto/') runs-on: ubuntu-latest env: GH_TOKEN: ${{ secrets.AUTO_PR_APPROVAL_BY_KEYMAN_STATUS }} permissions: write-all steps: - - name: Checkout - uses: actions/checkout@v6.0.2 - with: - sparse-checkout: | - README.md - sparse-checkout-cone-mode: false - name: Approve pull request run: | - gh pr review --approve ${{github.head_ref}} + gh pr review --repo ${{github.repository}} --approve ${{github.event.pull_request.number}} - name: Enable auto-merge run: | - gh pr merge --merge --auto ${{github.head_ref}} + gh pr merge --repo ${{github.repository}} --merge --auto ${{github.event.pull_request.number}}