diff --git a/.github/workflows/getLabels.js b/.github/workflows/getLabels.js index 2f8a21bae6fa..99060e7205eb 100644 --- a/.github/workflows/getLabels.js +++ b/.github/workflows/getLabels.js @@ -2,6 +2,8 @@ * To run this file: * * npm install @octokit/rest * * node .github/workflows/getLabels.js + * + * This script assumes the maximum number of labels to be 100. */ const { Octokit } = require('@octokit/rest'); @@ -10,8 +12,14 @@ github.rest.issues .listLabelsForRepo({ owner: 'microsoft', repo: 'vscode-python', + per_page: 100, }) .then((result) => { const labels = result.data.map((label) => label.name); - console.log(JSON.stringify(labels)); + console.log( + '\nNumber of labels found:', + labels.length, + ", verify that it's the same as number of labels listed in https://github.com/microsoft/vscode-python/labels\n", + ); + console.log(JSON.stringify(labels), '\n'); }); diff --git a/.github/workflows/issue-labels.yml b/.github/workflows/issue-labels.yml index 2e45c213d960..b10983dd0706 100644 --- a/.github/workflows/issue-labels.yml +++ b/.github/workflows/issue-labels.yml @@ -6,7 +6,7 @@ on: env: # To update the list of labels, see `getLabels.js`. - REPO_LABELS: '["area-data science","area-debugging","area-diagnostics","area-editor-*","area-environments","area-formatting","area-intellisense","area-internal","area-linting","area-terminal","area-testing","author-verification-requested","bug","community ask","debt","dependencies","documentation","experimenting","feature-request","good first issue","help wanted","important","info-needed","invalid-testplan-item","investigating","iteration-candidate","iteration-plan","iteration-plan-draft","javascript","linux"]' + REPO_LABELS: '["area-data science","area-debugging","area-diagnostics","area-editor-*","area-environments","area-formatting","area-intellisense","area-internal","area-linting","area-terminal","area-testing","author-verification-requested","bug","community ask","debt","dependencies","documentation","experimenting","feature-request","good first issue","help wanted","important","info-needed","invalid-testplan-item","investigating","iteration-candidate","iteration-plan","iteration-plan-draft","javascript","linux","macos","meta","needs community feedback","needs PR","needs proposal","needs spike","no-changelog","on-testplan","partner ask","regression","release-plan","reports-wanted","skip package*.json","skip tests","tensorboard","testplan-item","triage-needed","verification-found","verification-needed","verification-steps-needed","verified","windows"]' TRIAGERS: '["karrtikr","karthiknadig","paulacamargo25","eleanorjboyd"]' permissions: @@ -57,3 +57,13 @@ jobs: } else { console.log('This issue already has a "needs __", "iteration-plan", "release-plan", or the "testplan-item" label, do not add the "triage-needed" label.') } + const knownLabels = ${{ env.REPO_LABELS }} + for( const label of labels) { + if (!knownLabels.includes(label)) { + await github.rest.issues.deleteLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: label, + }) + } + }