Bug 40027

Summary: Use GitHub workflow to automatically close PRs opened on the Koha repo there
Product: Koha Reporter: Michał <schodkowy.omegi-0r>
Component: Developer documentationAssignee: Michał <schodkowy.omegi-0r>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: koha-bugs
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: [PATCH] Bug 40027: Use GitHub workflow to automatically close PRs opened on the Koha repo there

Description Michał 2025-05-29 13:39:11 UTC
This is simply based on: https://github.com/mozilla-firefox/firefox/blob/main/.github/workflows/close-pr.yml

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.

The message text is a combination of the Firefox's text with what people used to write when closing Koha's PRs. I think it should be good enough but of course feel free to share any suggestions for change if you feel like it needs one.

TEST PLAN:
None honestly. This workflow is proven to work on Firefox's repo. The only change is adding \n newlines to the comment for readability, which I didn't test for whether it works... Otherwise it can only be tested after merging (either to Koha repo or to some dummy test repo if you really want to).
Comment 1 Michał 2025-05-29 13:47:31 UTC
Created attachment 182839 [details] [review]
[PATCH] Bug 40027: Use GitHub workflow to automatically close PRs opened on the Koha repo there

[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
Comment 2 Michał 2025-05-29 13:49:47 UTC
Note 1: the presence of .github folder will not impact other git forges.

Note 2: the GH_TOKEN: ${{ github.token }} value is populated automatically on workflow's runtime by a temporary token belonging to GitHub Actions user and with a scope permitting basic changes to the repo, so there's no need to manually generate anything.