Skip to content

Commit 3fdc8b4

Browse files
committed
Add script to update prs in frontmatter
1 parent 29a7162 commit 3fdc8b4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

update-advancement-pr.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const argv = require('yargs').command(
2+
'* path stage prUrl',
3+
'update advancement PR in frontmatter',
4+
(yargs) => {
5+
return yargs
6+
.positional('path', {
7+
describe: 'file path of the RFC to update',
8+
type: 'string',
9+
})
10+
.positional('stage', {
11+
describe: 'the stage for advancement',
12+
type: 'string',
13+
})
14+
.positional('prUrl', {
15+
describe: 'the url of PR for advancement',
16+
type: 'string',
17+
})
18+
.demandOption(['path', 'stage', 'prUrl']);
19+
}
20+
).argv;
21+
22+
const { readFileSync, writeFileSync } = require('fs');
23+
24+
const Updater = require('./lib/frontmatter-updater');
25+
26+
let path = argv.path;
27+
let file = readFileSync(path, 'utf8');
28+
const updater = new Updater(file);
29+
let output = updater.updateMetadata({ prs: { [argv.stage]: argv.prUrl } });
30+
writeFileSync(path, output);

0 commit comments

Comments
 (0)