-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repo Gardening: update Type column in project board based off label (#…
…40110) * Repo Gardening: update Type column in project board based off label If we can extract the type of the issue from the labels, we will update our project board's "Type" column accordingly. * Get rid of extra label check when an issue is being labeled The added label is already returned by getLabels. * Simplify issue type management I made some changes to the One Board settings to make things simpler. * Fix project type extraction * Fix string check
- Loading branch information
Showing
5 changed files
with
159 additions
and
91 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/github-actions/repo-gardening/changelog/update-board-triage-issue-type-management
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: added | ||
|
||
Board Triage: automatically add the issue type to our project board when a Type label can be found in the issue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
projects/github-actions/repo-gardening/src/utils/labels/get-issue-type.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const getLabels = require( './get-labels' ); | ||
|
||
/* global GitHub */ | ||
|
||
/** | ||
* Extract the type of the issue, based of the the "[Type]" labels found in that issue. | ||
* If multiple Type labels can be found in the issue, we cannot extract a specific type. | ||
* We will consequently return an empty string. | ||
* | ||
* @param {GitHub} octokit - Initialized Octokit REST client. | ||
* @param {string} owner - Repository owner. | ||
* @param {string} repo - Repository name. | ||
* @param {string} number - Issue number. | ||
* @return {Promise<string>} Promise resolving to a string, the type of the issue, extracted from the label. | ||
*/ | ||
async function getIssueType( octokit, owner, repo, number ) { | ||
const labels = await getLabels( octokit, owner, repo, number ); | ||
|
||
// Extract type labels, and return them all in a new array, but without the [Type] prefix. | ||
const typeLabels = labels | ||
.filter( label => label.startsWith( '[Type]' ) ) | ||
.map( label => label.replace( '[Type] ', '' ) ); | ||
|
||
// If there are multiple types defined in the issue, we cannot extract a specific type. | ||
// We will consequently return an empty string. | ||
if ( typeLabels.length !== 1 ) { | ||
return ''; | ||
} | ||
|
||
return typeLabels[ 0 ]; | ||
} | ||
|
||
module.exports = getIssueType; |
31 changes: 0 additions & 31 deletions
31
projects/github-actions/repo-gardening/src/utils/labels/is-bug.js
This file was deleted.
Oops, something went wrong.