-
Notifications
You must be signed in to change notification settings - Fork 4.3k
chore: add workflow to auto add p1 bugs to project board #33205
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
84bdb9f
add workflow to auto add p1 bugs to project board
samson-keung 0535e5f
remove code comment
samson-keung 484728e
trigger on p1 and bug label only
samson-keung 6539c3d
add missing labels
samson-keung 5dfaf9c
Merge branch 'main' into auto-add-bug-to-board
mergify[bot] 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
This file contains hidden or 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,19 @@ | ||
| name: P1 Bug Prioritization | ||
| on: | ||
| issues: | ||
| types: | ||
| - labeled | ||
|
|
||
| jobs: | ||
| prioritize: | ||
| if: github.repository == 'aws/aws-cdk' && contains(github.event.issue.labels.*.name, 'bug') && contains(github.event.issue.labels.*.name, 'p1') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Add P1 Bug to project | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.PROJEN_GITHUB_TOKEN }} | ||
| script: | | ||
| const script = require('./scripts/prioritization/assign-bug-priority.js') | ||
| await script({github, context}) |
This file contains hidden or 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,55 @@ | ||
| const { PRIORITIES, LABELS, STATUS, ...PROJECT_CONFIG } = require('./project-config'); | ||
| const { | ||
| updateProjectField, | ||
| addItemToProject, | ||
| fetchProjectFields, | ||
| } = require('./project-api'); | ||
|
|
||
| module.exports = async ({ github, context }) => { | ||
| async function addToProject(issue) { | ||
| console.log(`Processing issue #${issue.number}...`); | ||
|
|
||
| // Get project fields | ||
| const projectFields = await fetchProjectFields({ | ||
| github, | ||
| org: PROJECT_CONFIG.org, | ||
| number: PROJECT_CONFIG.projectNumber | ||
| }); | ||
| const priorityField = projectFields.organization.projectV2.fields.nodes.find( | ||
| (field) => field.id === PROJECT_CONFIG.priorityFieldId | ||
| ); | ||
|
|
||
| const addResult = await addItemToProject({ | ||
| github, | ||
| projectId: PROJECT_CONFIG.projectId, | ||
| contentId: issue.node_id, | ||
| }); | ||
|
|
||
| const itemId = addResult.addProjectV2ItemById.item.id; | ||
|
|
||
| const priorityR6OptionId = priorityField.options.find( | ||
| (option) => option.name === PRIORITIES.R6 | ||
| )?.id; | ||
|
|
||
| if (!priorityR6OptionId) { | ||
| throw new Error(`Cannot find Id of the R6 priority option. | ||
| Found: ${priorityField.options.map(op => op.name)}`); | ||
| } | ||
|
|
||
| await updateProjectField({ | ||
| github, | ||
| projectId: PROJECT_CONFIG.projectId, | ||
| itemId: itemId, | ||
| fieldId: PROJECT_CONFIG.priorityFieldId, | ||
| value: priorityR6OptionId, | ||
| }); | ||
| } | ||
|
|
||
| const issue = context.payload.issue; | ||
| const labels = issue.labels.map((l) => l.name); | ||
| if (labels.includes(LABELS.P1) && labels.includes(LABELS.BUG)) { | ||
| await addToProject(issue); | ||
| } else { | ||
| // do nothing | ||
| } | ||
| }; | ||
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.