Bug 40027 - Use GitHub workflow to automatically close PRs opened on the Koha repo there
Summary: Use GitHub workflow to automatically close PRs opened on the Koha repo there
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Developer documentation (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial
Assignee: Michał
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-29 13:39 UTC by Michał
Modified: 2025-11-10 13:44 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.05,24.11.11
Circulation function:


Attachments
[PATCH] Bug 40027: Use GitHub workflow to automatically close PRs opened on the Koha repo there (2.31 KB, patch)
2025-05-29 13:47 UTC, Michał
Details | Diff | Splinter Review
Bug 40027: Use GitHub workflow to automatically close PRs opened on the Koha repo there (2.38 KB, patch)
2025-10-03 13:29 UTC, Imani
Details | Diff | Splinter Review
Bug 40027: Use GitHub workflow to automatically close PRs opened on the Koha repo there (2.45 KB, patch)
2025-10-06 10:23 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40027: (follow-up) Add .github/ to Makefile.PL (1.01 KB, patch)
2025-10-06 18:32 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.
Comment 3 Imani 2025-10-03 13:29:48 UTC
Created attachment 187386 [details] [review]
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>
Comment 4 Jonathan Druart 2025-10-06 10:23:24 UTC
Created attachment 187456 [details] [review]
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>
Comment 5 Lucas Gass (lukeg) 2025-10-06 15:16:41 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 6 Lucas Gass (lukeg) 2025-10-06 17:19:16 UTC
kohadev-koha@kohadevbox:koha(main)$ prove -v /kohadevbox/koha/xt/check_makefile.t
/kohadevbox/koha/xt/check_makefile.t .. 
1..3
ok 1 - We should test something
not ok 2 - All directories must be listed in Makefile.PL

#   Failed test 'All directories must be listed in Makefile.PL'
#   at /kohadevbox/koha/xt/check_makefile.t line 40.
#          got: '1'
#     expected: '0'
# $VAR1 = [
#           '.github'
#         ];
ok 3 - no warnings
# Looks like you failed 1 test of 3.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests 


Do we need to add the .github dir to Makefile.PL?
Comment 7 Tomás Cohen Arazi (tcohen) 2025-10-06 18:32:28 UTC
Created attachment 187493 [details] [review]
Bug 40027: (follow-up) Add .github/ to Makefile.PL

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Comment 8 Lucas Gass (lukeg) 2025-10-06 20:19:41 UTC
follow-up pushed to main
Comment 9 Paul Derscheid 2025-10-23 21:10:40 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 10 Fridolin Somers 2025-11-10 13:44:59 UTC
Pushed to 24.11.x for 24.11.11