diff --git a/eng/common/labels.yaml b/eng/common/labels.yaml index cf19541854..458696f218 100644 --- a/eng/common/labels.yaml +++ b/eng/common/labels.yaml @@ -90,7 +90,7 @@ color: 7C4B1E description: "" - name: triaged:core - color: 5319e7 + color: "5319e7" description: "" - name: tspd color: "004185" diff --git a/eng/common/scripts/sync-labels.ts b/eng/common/scripts/sync-labels.ts index 5f98796a36..172bb48fb6 100644 --- a/eng/common/scripts/sync-labels.ts +++ b/eng/common/scripts/sync-labels.ts @@ -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);