Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ensure any labels or assignees do not carry over when transferring issues to vscode-python #19656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/getLabels.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* To run this file:
* * npm install @octokit/rest
* * node .github/workflows/getLabels.js
*/

const { Octokit } = require('@octokit/rest');
const github = new Octokit();
github.rest.issues
.listLabelsForRepo({
owner: 'microsoft',
repo: 'vscode-python',
})
.then((result) => {
const labels = result.data.map((label) => label.name);
console.log(JSON.stringify(labels));
});
32 changes: 31 additions & 1 deletion .github/workflows/issue-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ on:
issues:
types: [opened, reopened]

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"]'
TRIAGERS: '["karrtikr","karthiknadig","paulacamargo25","eleanorjboyd"]'

permissions:
issues: write

jobs:
# From https://github.com/marketplace/actions/github-script#apply-a-label-to-an-issue.
add-classify-label:
name: "Add 'triage-needed'"
name: "Add 'triage-needed' and remove unrecognizable labels & assignees"
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
Expand All @@ -37,3 +42,28 @@ 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 }}
const knownTriagers = ${{ env.TRIAGERS }}
for( const label of labels) {
if (!knownLabels.includes(label)) {
await github.rest.issues.deleteLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label,
})
}
}
const currentAssignees = await github.rest.issues
.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
})
.then((result) => result.data.assignees.map((a) => a.login));
const assigneesToRemove = currentAssignees.filter(a => !knownTriagers.includes(a));
github.rest.issues.removeAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: assigneesToRemove,
});