-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add linked work items to job summary #93
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
Conversation
|
@copilot can you rebase and re-make these changes? I changed my action pretty significantly since originally requesting this (now native node action and not composite action with shell). |
I've rebased and remade the changes for the new native Node.js action structure. The changes are now in commit 77cd7b0. What Changed:
The functionality is the same as the original PR, but now works with the ES modules-based action instead of the old composite shell action. |
072aea1 to
3b80757
Compare
|
@copilot I had to manually |
- Add GitHub Actions notice annotations when work items are linked - Add work item information to job summary for visibility - Update tests to mock core.notice and core.summary - Update README with Action Output section This implements the original requirement to make it easier to see what work items were linked to the PR from the job output. Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Re-implemented the work item visibility feature in commit 42a4fac. Changes:
All 80 tests passing (51 JS + 29 bash). |
… removing the notices
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.
Pull request overview
This PR adds job summary functionality to display linked work items in the GitHub Actions workflow run summary. The changes track and display work items found in commits and PR title/body, making it easier for users to see which Azure DevOps work items are associated with a pull request.
Key Changes
- Added
core.summary.addRaw()calls to display work item linkages in the job summary page - Updated tests to mock and verify the summary functionality
- Added documentation describing the new visibility feature
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.js | Added job summary entries for work items from commits (when linking is enabled) and PR title/body, plus a final core.summary.write() call at the end of execution |
| tests/index.test.js | Added mocks for core.notice and core.summary, and assertions to verify summary entries are created for linked work items |
| README.md | Added "Action Output" section documenting the job summary feature and updated key features list |
| package.json | Version bump from 3.0.6 to 3.0.7 |
| package-lock.json | Version bump from 3.0.6 to 3.0.7 |
| badges/coverage.svg | Coverage decreased slightly from 80.56% to 80.36% |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for the thorough review Copilot! I've addressed the feedback: Implemented:
Dismissed:
|
|
Actually I am implementing suggestion |
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.
Pull request overview
Copilot reviewed 4 out of 6 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (2)
src/index.js:512
- This comment on line 512 is misleading. At this point in the code (within the validation-enabled branch), all work items in the PR title/body have already been added to
workItemToCommitMapwith anullvalue on line 490 (before validation). This meansworkItemToCommitMap.has(workItemNumber)will always return true for these work items, making the comment inaccurate.
The comment should clarify that the code is checking whether the work item came from a commit (non-null value) vs from the PR title/body (null value).
// Only add to summary if this work item wasn't already added from a commit
src/index.js:526
- The condition on line 527 will never be false when validation is disabled. In the validation-disabled path, work items from the PR title/body are only added to the map at line 528, which means line 527 will always evaluate to true the first time each work item is encountered.
However, this creates a different problem: if a work item appears in BOTH a commit AND the PR title/body, the commit version would have already been added to the map (with a non-null value) in the checkCommitsForWorkItems function. The current code would skip adding it to the summary (correct behavior), but it wouldn't set it to null on line 528 (which is fine since it already has a commit reference).
The logic appears to work correctly for the validation-disabled case, but the comment on line 526 is misleading - it should clarify that this prevents duplicate summary entries for work items that were already processed from commits.
// Only add to map and summary if this work item wasn't already added from a commit
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Draft Release CreatedA draft release v3.0.8 has been created for this PR. Next Steps
|
Summary
Re-implemented the work item visibility feature after branch was reset to main.
Changes Made
1. Work Item Linkage Visibility
GitHub Actions Notices: Added
core.notice()calls when work items are linked, displaying annotations in the workflow runWork item AB#12345 (from commit abc123d) linked to pull request #42Pull request linked to work item AB#12345Job Summary: Added entries to
core.summarythat appear on the job summary page2. Test Updates
__tests__/index.test.jsto mockcore.noticeandcore.summary3. Documentation
Testing
✅ All 80 tests passing (51 JS + 29 bash)
✅ Action successfully packaged to dist/
Files Changed
core.notice()andcore.summarycalls when work items are linked (36 lines added)core.noticeandcore.summary(13 lines added)Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.