From 444d0f909b9df3fa4beeb2146e3bd6734e88b679 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 21 Jan 2025 13:19:00 +0100 Subject: [PATCH] fix(git-node): allow security release promotion --- components/git/release.js | 5 +++-- lib/promote_release.js | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/git/release.js b/components/git/release.js index 51ea89a5..47f88bba 100644 --- a/components/git/release.js +++ b/components/git/release.js @@ -112,9 +112,10 @@ function release(state, argv) { } async function main(state, argv, cli, dir) { - const prID = /^(?:https:\/\/github\.com\/nodejs\/node\/pull\/)?(\d+)$/.exec(argv.prid); + const prID = /^(?:https:\/\/github\.com\/nodejs(-private)?\/node\1\/pull\/)?(\d+)$/.exec(argv.prid); if (prID) { - argv.prid = Number(prID[1]); + if (prID[1]) argv.security = true; + argv.prid = Number(prID[2]); } if (state === PREPARE) { const release = new ReleasePreparation(argv, cli, dir); diff --git a/lib/promote_release.js b/lib/promote_release.js index d717110f..5bfbdac6 100644 --- a/lib/promote_release.js +++ b/lib/promote_release.js @@ -19,6 +19,10 @@ export default class ReleasePromotion extends Session { constructor(argv, req, cli, dir) { super(cli, dir, argv.prid); this.req = req; + if (argv.security) { + this.config.owner = 'nodejs-private'; + this.config.repo = 'node-private'; + } this.dryRun = !argv.run; this.isLTS = false; this.ltsCodename = ''; @@ -422,7 +426,7 @@ export default class ReleasePromotion extends Session { '-m', `Working on ${workingOnVersion}`, '-m', - `PR-URL: https://github.com/nodejs/node/pull/${prid}` + `PR-URL: https://github.com/${this.config.owner}/${this.config.owner}/pull/${prid}` ], { ignoreFailure: false }); const workingOnNewReleaseCommit = await forceRunAsync('git', ['rev-parse', 'HEAD'], { ignoreFailure: false, captureStdout: true });