From a705a34a22e7b528c47f0b1486066c8398680e95 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 19 Oct 2025 11:27:00 +0200 Subject: [PATCH] ci/github-script/labels: prevent closing purposely-empty PRs Some PRs are empty on purpose, for example the yearly notification about the election for voters. We should not close these because the merge commit is empty - only if there was a change intended, but the merge commit *becomes* empty, we should act. --- ci/github-script/labels.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/github-script/labels.js b/ci/github-script/labels.js index c57a9bb60a56..2d7bafb6c5ae 100644 --- a/ci/github-script/labels.js +++ b/ci/github-script/labels.js @@ -26,7 +26,10 @@ module.exports = async ({ github, context, core, dry }) => { // be detected, no maintainers pinged. // We can just check the temporary merge commit, and if it's empty the PR can safely be // closed - there are no further changes. - if (pull_request.merge_commit_sha) { + // We only do this for PRs, which are non-empty to start with. This avoids closing PRs + // which have been created with an empty commit for notification purposes, for example + // the yearly election notification for voters. + if (pull_request.merge_commit_sha && pull_request.changed_files > 0) { const commit = ( await github.rest.repos.getCommit({ ...context.repo,