Skip to content

Commit

Permalink
Label sync
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin committed May 11, 2024
1 parent c89ed8e commit 48f0905
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion eng/common/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
color: 7C4B1E
description: ""
- name: triaged:core
color: 5319e7
color: "5319e7"
description: ""
- name: tspd
color: "004185"
Expand Down
9 changes: 8 additions & 1 deletion eng/common/scripts/sync-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ interface UpdateGithubLabelOptions {
readonly dryRun?: boolean;
}
async function updateGithubLabels(labels: Label[], options: UpdateGithubLabelOptions = {}) {
const octokit = new Octokit({ auth: `token ${process.env.GITHUB_TOKEN}` });
if (!options.dryRun && !process.env.GITHUB_TOKEN) {
throw new Error(
"GITHUB_TOKEN environment variable is required when not running in dry-run mode"
);
}
const octokit = new Octokit(
process.env.GITHUB_TOKEN ? { auth: `token ${process.env.GITHUB_TOKEN}` } : {}
);

const existingLabels = await fetchAllLabels(octokit);
console.log("Existing labels", existingLabels);
Expand Down

0 comments on commit 48f0905

Please sign in to comment.