From b371b9e17d8274dbf7a63a9aa5922d33f2acfa32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kula?= <148193449+miku-orb@users.noreply.github.com> Date: Thu, 29 May 2025 15:43:53 +0200 Subject: [PATCH] Bug 40027: Use GitHub workflow to automatically close PRs opened on the Koha repo there Automatically redirect users who try to submit a PR at GitHub to instructions on how to submit patches and close the PR. Better experience for potential new developers (since they get immediate feedback, while still in the flow for submitting the patch). The sparse checkout of readme is probably required, so that the gh command knows on what repo to work with. Based on: https://github.com/mozilla-firefox/firefox/blob/main/.github/workflows/close-pr.yml --- .github/workflows/close-pr.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/close-pr.yml diff --git a/.github/workflows/close-pr.yml b/.github/workflows/close-pr.yml new file mode 100644 index 0000000000..01c7a1586a --- /dev/null +++ b/.github/workflows/close-pr.yml @@ -0,0 +1,20 @@ +name: close pull request +on: + pull_request_target: + types: [opened, reopened] +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: checkout + 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: | + gh pr close ${{ env.PR }} --comment "(Automated Close) Please do not file pull requests here, this repo is merely a clone of https://git.koha-community.org/Koha-community/Koha and we use Bugzilla at https://bugs.koha-community.org to submit patches to its codebase.\n\nSee https://wiki.koha-community.org/wiki/Submitting_A_Patch for more information. Note that you can use [`koha-testing-docker`](https://gitlab.com/koha-community/koha-testing-docker) to easily set-up a full development environment, which includes the `git bz` command to easily push your patches with a single command, instead of manually fiddling with patch files!\n\nIf you have any more questions or need help, do not hesitate to ask in our Mattermost chat: https://chat.koha-community.org. Thank you." + gh pr lock ${{ env.PR }} -- 2.48.1