From fe2d53e73ac98af12bd5d4d73edd801582c5c607 Mon Sep 17 00:00:00 2001 From: glob Date: Wed, 20 Sep 2023 15:33:26 +0000 Subject: [PATCH] Bug 1853618 - address issue with GitHub PR closer, and optimise r=hwine DONTBUILD - run action in the context of the target repo, rather than the fork - use a cleaner way to obtain the pull request number - utilise a sparse checkout to avoid unnecessary I/O Differential Revision: https://phabricator.services.mozilla.com/D188430 --- .github/workflows/close-pr.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/close-pr.yml b/.github/workflows/close-pr.yml index 4f13d19da9af7d..a881cde247f6cb 100644 --- a/.github/workflows/close-pr.yml +++ b/.github/workflows/close-pr.yml @@ -1,17 +1,20 @@ name: close pull request on: - pull_request: + pull_request_target: types: [opened, reopened] jobs: run: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + sparse-checkout: "README.txt" + sparse-checkout-cone-mode: false - name: close env: GH_TOKEN: ${{ github.token }} + PR: ${{ github.event.number }} run: | - PR=$(echo "$GITHUB_REF" | awk 'BEGIN { FS = "/" } ; { print $3 }') - gh pr close $PR --comment "(Automated Close) Please do not file pull requests here, see https://firefox-source-docs.mozilla.org/contributing/how_to_submit_a_patch.html" - gh pr lock $PR + gh pr close ${{ env.PR }} --comment "(Automated Close) Please do not file pull requests here, see https://firefox-source-docs.mozilla.org/contributing/how_to_submit_a_patch.html" + gh pr lock ${{ env.PR }}