-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add needs-attention field assignment for prioritization board (#…
…33311) ### Issue # (if applicable) N/A ### Reason for this change Update Needs Attention field in the prioritization project board ### Description of changes Monitors project items daily to identify PRs that have been in their current status for extended periods. ### Describe any new or updated permissions being added N/A ### Description of how you validated changes Unit test is added. Integ test is not applicable. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
1 parent
8c40341
commit 34821f2
Showing
8 changed files
with
343 additions
and
10 deletions.
There are no files selected for viewing
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
20 changes: 20 additions & 0 deletions
20
.github/workflows/project-prioritization-needs-attention.yml
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,20 @@ | ||
name: PR Prioritization Needs Attention Status | ||
on: | ||
schedule: | ||
- cron: '0 7 * * 1-5' # Runs at 7AM every day during weekdays | ||
workflow_dispatch: # Manual trigger | ||
|
||
jobs: | ||
update_project_status: | ||
if: github.repository == 'aws/aws-cdk' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Update Needs Attention Status | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.PROJEN_GITHUB_TOKEN }} | ||
script: | | ||
const script = require('./scripts/prioritization/update-attention-status.js') | ||
await script({github}) |
1 change: 0 additions & 1 deletion
1
scripts/@aws-cdk/script-tests/prioritization/assign-r5-priority.test.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
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
112 changes: 112 additions & 0 deletions
112
scripts/@aws-cdk/script-tests/prioritization/update-attention-status.test.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,112 @@ | ||
const { STATUS, NEEDS_ATTENTION_STATUS, ...PROJECT_CONFIG } = require('../../../../scripts/prioritization/project-config'); | ||
const { | ||
createMockGithubForNeedsAttention, | ||
OPTION_IDS | ||
} = require('./helpers/mock-data'); | ||
|
||
const updateAttentionStatus = require('../../../../scripts/prioritization/update-attention-status'); | ||
|
||
describe('Needs Attention Status Assignment', () => { | ||
let mockGithub; | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
async function verifyProjectState(expectedAttentionStatus) { | ||
const calls = mockGithub.graphql.mock.calls; | ||
|
||
if (!expectedAttentionStatus) { | ||
const attentionUpdateCall = calls.find(call => | ||
call[1].input?.fieldId === PROJECT_CONFIG.attentionFieldId | ||
); | ||
expect(attentionUpdateCall).toBeUndefined(); | ||
return; | ||
} | ||
|
||
// Verify attention status update | ||
const attentionUpdateCall = calls.find(call => | ||
call[1].input?.fieldId === PROJECT_CONFIG.attentionFieldId | ||
); | ||
expect(attentionUpdateCall[1].input.value.singleSelectOptionId) | ||
.toBe(expectedAttentionStatus); | ||
} | ||
|
||
describe('Needs Attention Status Tests', () => { | ||
test('should set Extended status for items in status 7-14 days', async () => { | ||
mockGithub = createMockGithubForNeedsAttention({ | ||
status: STATUS.READY, | ||
daysInStatus: 10 | ||
}); | ||
|
||
await updateAttentionStatus({ github: mockGithub }); | ||
await verifyProjectState(NEEDS_ATTENTION_STATUS.EXTENDED.name); | ||
}); | ||
|
||
test('should set Aging status for items in status 14-21 days', async () => { | ||
mockGithub = createMockGithubForNeedsAttention({ | ||
status: STATUS.IN_PROGRESS, | ||
daysInStatus: 16 | ||
}); | ||
|
||
await updateAttentionStatus({ github: mockGithub }); | ||
await verifyProjectState(NEEDS_ATTENTION_STATUS.AGING.name); | ||
}); | ||
|
||
test('should set Stalled status for items in status >21 days', async () => { | ||
mockGithub = createMockGithubForNeedsAttention({ | ||
status: STATUS.PAUSED, | ||
daysInStatus: 25 | ||
}); | ||
|
||
await updateAttentionStatus({ github: mockGithub }); | ||
await verifyProjectState(NEEDS_ATTENTION_STATUS.STALLED.name); | ||
}); | ||
|
||
test('should not set attention status for items under threshold', async () => { | ||
mockGithub = createMockGithubForNeedsAttention({ | ||
status: STATUS.ASSIGNED, | ||
daysInStatus: 5 | ||
}); | ||
|
||
await updateAttentionStatus({ github: mockGithub }); | ||
await verifyProjectState(null); | ||
}); | ||
|
||
test('should not set attention status for non-monitored status', async () => { | ||
mockGithub = createMockGithubForNeedsAttention({ | ||
status: STATUS.DONE, | ||
daysInStatus: 25 | ||
}); | ||
|
||
await updateAttentionStatus({ github: mockGithub }); | ||
await verifyProjectState(null); | ||
}); | ||
|
||
test('should handle multiple items with different statuses', async () => { | ||
mockGithub = createMockGithubForNeedsAttention({ | ||
items: [ | ||
{ status: STATUS.READY, daysInStatus: 10 }, | ||
{ status: STATUS.IN_PROGRESS, daysInStatus: 16 }, | ||
{ status: STATUS.PAUSED, daysInStatus: 25 }, | ||
{ status: STATUS.DONE, daysInStatus: 30 } | ||
] | ||
}); | ||
|
||
await updateAttentionStatus({ github: mockGithub }); | ||
|
||
const calls = mockGithub.graphql.mock.calls; | ||
const attentionCalls = calls.filter(call => | ||
call[1].input?.fieldId === PROJECT_CONFIG.attentionFieldId | ||
); | ||
|
||
expect(attentionCalls).toHaveLength(3); // Only 3 items should be updated | ||
expect(attentionCalls[0][1].input.value.singleSelectOptionId) | ||
.toBe(NEEDS_ATTENTION_STATUS.EXTENDED.name); | ||
expect(attentionCalls[1][1].input.value.singleSelectOptionId) | ||
.toBe(NEEDS_ATTENTION_STATUS.AGING.name); | ||
expect(attentionCalls[2][1].input.value.singleSelectOptionId) | ||
.toBe(NEEDS_ATTENTION_STATUS.STALLED.name); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.