Skip to content

Add workflow to close community PRs with a canned comment using Close-PR- labels - #8235

Merged
bmarty merged 3 commits into
developfrom
bma/close-need-meta
Dec 1, 2026
Merged

bmarty merged 3 commits into
developfrom
bma/close-need-meta

Conversation

@bmarty

@bmarty bmarty commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Content

  • Add a workflow .github/workflows/close-pr.yml: when a label starting with Close-PR- is added to a pull request, it posts the comment stored in .github/comments/close-pr-<reason>.md and closes the pull request.
    • The workflow waits 10 seconds and checks that the label is still present before acting, so that a label added by mistake can be removed in time.
    • Only the comment files are checked out, from the base branch, never the PR code.
    • Adding a new reason only requires creating a label and its comment file.
  • Add comments for 7 reasons. The labels have already been created in the repository:
Label Use case
Close-PR-Need-Meta No approved issue in element-meta
Close-PR-Not-Upstream PR opened by mistake from a fork (fork sync, rebranded fork)
Close-PR-Not-Planned Change discussed and not accepted
Close-PR-Rich-Text-Editor Change belongs in matrix-rich-text-editor
Close-PR-Rust-SDK Change belongs in matrix-rust-sdk
Close-PR-Translations Translations must go through Localazy
Close-PR-Low-Effort PR does not meet the contributing guidelines
  • Bonus: the community PR notice workflow now uses the gh CLI and a Markdown file for its comment.

Motivation and context

Ease closing community PRs with a consistent and maintainable explanation.

To choose the labels, I looked at all the closed (not merged) community PRs (148 PRs from forks) and the maintainer comments on them, and kept the most frequent reasons for closing. The Close-PR- prefix (instead of Close-) leaves room for Close-Issue- labels if we add a similar workflow for issues later, and avoids the PR- prefix used for the changelog.

Past community PRs closed for each reason

Not listed: PRs that were superseded or duplicated, closed by their author, abandoned, or with an unclear reason.

Screenshots / GIFs

N/A

Tests

  • actionlint and zizmor report no issue.
  • Can only be tested once merged, since pull_request_target uses the workflow from the base branch: add a Close-PR- label to a PR, check that the comment is posted and the PR closed. Remove the label within 10 seconds and check that nothing happens.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • I am aware of the etiquette.
  • This PR was made with the help of AI:
    • Yes. In this case, please request a review by Copilot.
    • No.
  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly defines what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

🤖 Generated with Claude Code

bmarty and others added 2 commits November 23, 2026 09:26
When a label starting with `Close-PR-` is added to a pull request, post the
comment stored in `.github/comments/close-pr-<reason>.md` and close the pull
request. Storing the comments in Markdown files eases maintenance, and adding
a new reason only requires creating the label and its comment file.

The workflow waits 10 seconds and checks that the label is still present before
acting, so that a label added by mistake can be removed in time.

Add comments for the most frequent reasons we closed community PRs in the
past: Close-PR-Need-Meta, Close-PR-Not-Upstream, Close-PR-Not-Planned,
Close-PR-Rich-Text-Editor, Close-PR-Rust-SDK, Close-PR-Translations and
Close-PR-Low-Effort.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the welcome comment text to `.github/comments/fork-pr-notice.md` so it is
easier to maintain, and post it with `gh pr comment` instead of
`actions/github-script`, consistent with the Close-Need-Meta workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bmarty bmarty added the PR-Build For changes related to build, tools, CI/CD label Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/oxCpZB

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.11%. Comparing base (70ad03f) to head (3652571).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8235   +/-   ##
========================================
  Coverage    81.11%   81.11%           
========================================
  Files         2906     2906           
  Lines        87593    87593           
  Branches     11906    11906           
========================================
  Hits         71052    71052           
  Misses       11900    11900           
  Partials      4641     4641           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

Copy link
Copy Markdown

@bmarty

bmarty commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

(I sent one of the canned comment manually in 8261 - not using # deliberately)

@bmarty
bmarty marked this pull request as ready for review December 1, 2026 13:50
@bmarty
bmarty requested a review from a team as a code owner December 1, 2026 13:50
@bmarty
bmarty requested review from ganfra and removed request for a team December 1, 2026 13:50

@ganfra ganfra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thanks for this

@bmarty
bmarty merged commit aad0d3a into develop Dec 1, 2026
30 of 31 checks passed
@bmarty
bmarty deleted the bma/close-need-meta branch December 1, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Build For changes related to build, tools, CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants