Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 7, 2025

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 run

    • For commits: Work item AB#12345 (from commit abc123d) linked to pull request #42
    • For PR title/body: Pull request linked to work item AB#12345
  • Job Summary: Added entries to core.summary that appear on the job summary page

    • Includes clickable markdown links to commits
    • Provides quick reference of all linked work items

2. Test Updates

  • Updated __tests__/index.test.js to mock core.notice and core.summary
  • All 51 JavaScript tests passing
  • All 29 bash tests passing

3. Documentation

  • Added "Action Output" section to README.md explaining the new visibility features
  • Updated Key Features list to include visibility & tracking

Testing

✅ All 80 tests passing (51 JS + 29 bash)
✅ Action successfully packaged to dist/

Files Changed

  • src/index.js: Added core.notice() and core.summary calls when work items are linked (36 lines added)
  • tests/index.test.js: Added mocks for core.notice and core.summary (13 lines added)
  • README.md: Added "Action Output" section documenting the new visibility features (10 lines added)
Original prompt

This section details on the original issue you should resolve

<issue_title>Add information on linkage to job summary or ::info</issue_title>
<issue_description>From the job, make it easier to see what work item(s) were linked to PR

  echo "Pull request linked to work item number: $WORKITEM_NUMBER"
  # TODO: validate work item?
  # TODO: add this as an ::info or to the job summary?</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #68

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Add information on linkage to job summary Add work item linkage information to job summary and notices Oct 7, 2025
Copilot AI requested a review from joshjohanning October 7, 2025 16:53
@joshjohanning
Copy link
Owner

@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).

Copy link
Contributor Author

Copilot AI commented Nov 7, 2025

@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:

  • Added core.notice() annotations when work items are linked (visible in workflow run annotations)
  • Added entries to core.summary for the job summary page with clickable links
  • Updated tests to mock the new core functions
  • Updated README with Action Output documentation

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.

@joshjohanning joshjohanning force-pushed the copilot/add-info-to-job-summary branch from 072aea1 to 3b80757 Compare November 7, 2025 21:14
@joshjohanning
Copy link
Owner

@copilot I had to manually git fetch origin main && git reset --hard origin/main to get the latest in this working branch. Now you have to re-implement the original requirement.

- 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>
Copy link
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot I had to manually git fetch origin main && git reset --hard origin/main to get the latest in this working branch. Now you have to re-implement the original requirement.

Re-implemented the work item visibility feature in commit 42a4fac.

Changes:

  • Added core.notice() annotations when work items are linked (visible in workflow annotations)
  • Added entries to core.summary for the job summary page with clickable links to commits
  • Updated tests to mock the new core functions
  • Updated README with Action Output documentation

All 80 tests passing (51 JS + 29 bash).

@joshjohanning joshjohanning changed the title Add work item linkage information to job summary and notices feat: add linked work items to job summary Jan 6, 2026
@joshjohanning joshjohanning marked this pull request as ready for review January 6, 2026 21:01
Copilot AI review requested due to automatic review settings January 6, 2026 21:01
Copy link
Contributor

Copilot AI left a 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.

@joshjohanning
Copy link
Owner

Thanks for the thorough review Copilot! I've addressed the feedback:

Implemented:

  • #1 - Removed unused mockNotice mock from tests
  • #2 - Updated README to accurately describe "displays associated work items" instead of "clickable links to work items"
  • #5 & #6 - Fixed duplicate job summary entries by checking workItemToCommitMap before adding PR work items
  • #7 - Fixed stale comment that referenced "notices"

Dismissed:

  • #3 - Adding job summary entries when linking is disabled adds complexity. The current behavior (only showing linked items) keeps the summary focused on actionable items.
  • #4 - The suggested helper function extraction is over-engineering for the current code structure. The two code paths have different contexts and the duplication is minimal.

@joshjohanning
Copy link
Owner

Actually I am implementing suggestion #3 re: job summary and verifying work items.

Copy link
Contributor

Copilot AI left a 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 workItemToCommitMap with a null value on line 490 (before validation). This means workItemToCommitMap.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.

@joshjohanning joshjohanning merged commit 1370072 into main Jan 6, 2026
4 checks passed
@joshjohanning joshjohanning deleted the copilot/add-info-to-job-summary branch January 6, 2026 21:51
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

📦 Draft Release Created

A draft release v3.0.8 has been created for this PR.

🔗 View Draft Release

Next Steps

  • Review the release notes
  • Publish the release to make it permanent

This is an automated reminder from the publish-github-action workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add information on linkage to job summary or ::info

2 participants