-
Notifications
You must be signed in to change notification settings - Fork 800
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
Priority indicators: update logic to match new priority matrix #40672
Open
jeherve
wants to merge
1
commit into
trunk
Choose a base branch
from
update/repo-gardening-priority-indicators
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/github-actions/repo-gardening/changelog/update-repo-gardening-priority-indicators
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: major | ||
Type: changed | ||
|
||
Issue triage: update priority matrix. |
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 |
---|---|---|
|
@@ -2,37 +2,78 @@ const debug = require( '../debug' ); | |
|
||
/** | ||
* Figure out the priority of the issue, based off issue contents. | ||
* Logic follows this priority matrix: pciE2j-oG-p2 | ||
* Logic follows this priority matrix: pfVjQF-su-p2 | ||
* | ||
* @param {string} body - The issue content. | ||
* @return {string} Priority of issue. | ||
*/ | ||
function findPriority( body ) { | ||
let priority = 'TBD'; | ||
|
||
debug( `find-priority: Looking for priority indicators in issue body: ${ body }` ); | ||
|
||
// Look for priority indicators in body. | ||
const priorityRegex = | ||
/###\sImpact\n\n(?<impact>.*)\n\n###\sAvailable\sworkarounds\?\n\n(?<blocking>.*)\n/gm; | ||
/###\sSite\sowner\simpact\n\n(?<impact>.*)\n\n###\sSeverity\n\n(?<severity>.*)\n\n###\sWhat\sother\simpact\(s\)\sdoes\sthis\sissue\shave\?\n\n(?<extra>.*)\n/gm; | ||
let match; | ||
while ( ( match = priorityRegex.exec( body ) ) ) { | ||
const [ , impact = '', blocking = '' ] = match; | ||
const { impact = '', extra = '' } = match.groups || {}; | ||
let { severity = '' } = match.groups || {}; | ||
|
||
debug( | ||
`find-priority: Reported priority indicators for issue: "${ impact }" / "${ blocking }"` | ||
`find-priority: Reported priority indicators for issue: "${ impact }" / "${ severity }" / "${ extra }"` | ||
); | ||
|
||
if ( blocking === 'No and the platform is unusable' ) { | ||
return impact === 'One' ? 'High' : 'BLOCKER'; | ||
} else if ( blocking === 'No but the platform is still usable' ) { | ||
return 'High'; | ||
} else if ( blocking === 'Yes, difficult to implement' ) { | ||
return impact === 'All' ? 'High' : 'Normal'; | ||
} else if ( blocking !== '' && blocking !== '_No response_' ) { | ||
return impact === 'All' || impact === 'Most (> 50%)' ? 'Normal' : 'Low'; | ||
// Folks can provide additional information that can bump severity. | ||
// We also do not want that extra information to downgrade the severity. | ||
if ( extra !== '' && extra !== '_No response_' && extra !== 'No revenue impact' ) { | ||
if ( | ||
( extra === 'Individual site owner revenue' || extra === 'Agency or developer revenue' ) && | ||
severity !== 'Critical' | ||
) { | ||
severity = 'Major'; | ||
} else if ( extra === 'Platform revenue' ) { | ||
severity = 'Critical'; | ||
} | ||
} | ||
|
||
const impactIndicators = { | ||
isolated: 'Less than 20% of all', | ||
scattered: 'Between 20% and 60% of all', | ||
widespread: 'More than 60% of all', | ||
}; | ||
|
||
if ( severity === 'Critical' ) { | ||
priority = impact === impactIndicators.isolated ? 'High' : 'BLOCKER'; | ||
} else if ( severity === 'Major' ) { | ||
if ( impact === impactIndicators.widespread ) { | ||
priority = 'BLOCKER'; | ||
} else if ( impact === impactIndicators.scattered ) { | ||
priority = 'High'; | ||
} else { | ||
priority = 'Normal'; | ||
} | ||
} else if ( severity === 'Moderate' ) { | ||
if ( impact === impactIndicators.widespread ) { | ||
priority = 'High'; | ||
} else if ( impact === impactIndicators.scattered ) { | ||
priority = 'Normal'; | ||
} else { | ||
priority = 'Low'; | ||
} | ||
} else if ( severity !== '' && severity !== '_No response_' ) { | ||
priority = impact === impactIndicators.widespread ? 'Normal' : 'Low'; | ||
} else { | ||
priority = 'TBD'; | ||
} | ||
return 'TBD'; | ||
} | ||
|
||
debug( `find-priority: No priority indicators found.` ); | ||
return 'TBD'; | ||
debug( | ||
`find-priority: ${ | ||
priority === 'TBD' ? 'No ' : ' ' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If
Should there be something other than just a space in the else case? |
||
}priority indicators found. Priority set to ${ priority }.` | ||
); | ||
return priority; | ||
} | ||
|
||
module.exports = findPriority; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're allowing multiple selections for the
additional-impact
in #40501. This logic assumes they can select only one.