ci/github-script: allow running without dry mode

Changed files
+5 -4
ci
github-script
run
+5 -4
ci/github-script/run
···
import { program } from 'commander'
import { getOctokit } from '@actions/github'
-
async function run(action, owner, repo, pull_number) {
+
async function run(action, owner, repo, pull_number, dry) {
const token = execSync('gh auth token', { encoding: 'utf-8' }).trim()
const github = getOctokit(token)
···
process.exitCode = 1
},
},
-
dry: true,
+
dry,
})
} finally {
rmSync(tmp, { recursive: true })
···
.argument('<owner>', 'Owner of the GitHub repository to label (Example: NixOS)')
.argument('<repo>', 'Name of the GitHub repository to label (Example: nixpkgs)')
.argument('[pr]', 'Number of the Pull Request to label')
-
.action(async (owner, repo, pr) => {
+
.option('--no-dry', 'Make actual modifications')
+
.action(async (owner, repo, pr, options) => {
const labels = (await import('./labels.js')).default
-
run(labels, owner, repo, pr)
+
run(labels, owner, repo, pr, options.dry)
})
await program.parse()