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

Signed-off-by: Imani Thomas <imani.thomas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Michał Kula 2025-05-29 15:43:53 +02:00 committed by Lucas Gass
parent 2bf041ca4c
commit d6b95024bc
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 20 additions and 0 deletions

20
.github/workflows/close-pr.yml vendored Normal file
View File

@ -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 }}