diff --git a/ci/github-script/check-cherry-picks.md b/ci/github-script/check-cherry-picks.md deleted file mode 100644 index cda9936d6e30..000000000000 --- a/ci/github-script/check-cherry-picks.md +++ /dev/null @@ -1,15 +0,0 @@ -This report is automatically generated by the `PR / Check / cherry-pick` CI workflow. - -Some of the commits in this PR require the author's and reviewer's attention. - -Please follow the [backporting guidelines](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#how-to-backport-pull-requests) and cherry-pick with the `-x` flag. -This requires changes to the unstable `master` and `staging` branches first, before backporting them. - -Occasionally, commits are not cherry-picked at all, for example when updating minor versions of packages which have already advanced to the next major on unstable. -These commits can optionally be marked with a `Not-cherry-picked-because: ` footer. - -Sometimes it is not possible to cherry-pick exactly the same patch. -This most frequently happens when resolving merge conflicts. -The range-diff will help to review the resolution of conflicts. - -If you need to merge this PR despite the warnings, please [dismiss](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/dismissing-a-pull-request-review) this review shortly before merging. diff --git a/ci/github-script/commits.js b/ci/github-script/commits.js index f155898a5c7e..82fedd608b06 100644 --- a/ci/github-script/commits.js +++ b/ci/github-script/commits.js @@ -33,6 +33,7 @@ module.exports = async function ({ github, context, core, dry }) { commit, severity: 'important', message: `${sha} is not a cherry-pick, because: ${noCherryPick[1]}. Please review this commit manually.`, + type: 'no-cherry-pick', } // Using the last line with "cherry" + hash, because a chained backport @@ -47,6 +48,7 @@ module.exports = async function ({ github, context, core, dry }) { commit, severity: 'warning', message: `Couldn't locate original commit hash in message of ${sha}.`, + type: 'no-commit-hash', } const original_sha = cherry[1] @@ -133,6 +135,7 @@ module.exports = async function ({ github, context, core, dry }) { colored_diff, severity: 'warning', message: `Difference between ${sha} and original ${original_sha} may warrant inspection.`, + type: 'diff', } } @@ -214,10 +217,29 @@ module.exports = async function ({ github, context, core, dry }) { if (results.some(({ severity }) => severity == 'error')) process.exitCode = 1 - core.summary.addRaw( - await readFile(join(__dirname, 'check-cherry-picks.md'), 'utf-8'), - true, - ) + core.summary.addRaw('This report is automatically generated by the `PR / Check / cherry-pick` CI workflow.', true) + core.summary.addEOL() + core.summary.addRaw("Some of the commits in this PR require the author's and reviewer's attention.", true) + core.summary.addEOL() + + if (results.some(({ type }) => type === 'no-commit-hash')) { + core.summary.addRaw('Please follow the [backporting guidelines](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#how-to-backport-pull-requests) and cherry-pick with the `-x` flag.', true) + core.summary.addRaw('This requires changes to the unstable `master` and `staging` branches first, before backporting them.', true) + core.summary.addEOL() + core.summary.addRaw('Occasionally, commits are not cherry-picked at all, for example when updating minor versions of packages which have already advanced to the next major on unstable.', true) + core.summary.addRaw('These commits can optionally be marked with a `Not-cherry-picked-because: ` footer.', true) + core.summary.addEOL() + } + + if (results.some(({ type }) => type === 'diff')) { + core.summary.addRaw('Sometimes it is not possible to cherry-pick exactly the same patch.', true) + core.summary.addRaw('This most frequently happens when resolving merge conflicts.', true) + core.summary.addRaw('The range-diff will help to review the resolution of conflicts.', true) + core.summary.addEOL() + } + + core.summary.addRaw('If you need to merge this PR despite the warnings, please [dismiss](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/dismissing-a-pull-request-review) this review shortly before merging.', true) + results.forEach(({ severity, message, diff }) => { if (severity == 'info') return