Skip to content

Commit bf34e7b

Browse files
committed
Add dry run mode
1 parent 89ad60f commit bf34e7b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/update-issues.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import bcd from "@mdn/browser-compat-data" with { type: 'json' };
44
import { Octokit } from "@octokit/rest";
55
import { throttling } from "@octokit/plugin-throttling";
66

7+
const dryRun = process.argv.includes("--dry-run");
8+
79
// A special comment in the issue body is used to store the web-features
810
// ID, <!-- web-features:some-feature -->. Whitespace is allowed wherever
911
// possible to make the matching less brittle to changes.
@@ -169,6 +171,10 @@ async function update() {
169171
if (issue.title !== title || issue.body !== body) {
170172
// Update the issue. This might happen as a result of a change in
171173
// web-features or if we change the format of the issue body.
174+
if (dryRun) {
175+
console.log(`Dry run. Would update issue for ${id}.`);
176+
continue;
177+
}
172178
console.log(`Updating issue for ${id}.`);
173179
await octokit.rest.issues.update({
174180
...params,
@@ -179,6 +185,10 @@ async function update() {
179185
}
180186
} else {
181187
// Create a new issue.
188+
if (dryRun) {
189+
console.log(`Dry run. Would create new issue for ${id}.`);
190+
continue;
191+
}
182192
console.log(`Creating new issue for ${id}.`);
183193
await octokit.rest.issues.create({
184194
...params,

0 commit comments

Comments
 (0)