Add triggering issue/PR/discussion reference to safe output footers#1734
Merged
Add triggering issue/PR/discussion reference to safe output footers#1734
Conversation
- Modified generateFooter function to accept and display triggering issue/PR/discussion numbers - Updated create_issue.cjs, add_comment.cjs, and create_pr_review_comment.cjs - Added tests for new footer functionality - All 519 JavaScript tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- All JavaScript tests passing (519 tests) - All Go tests passing - Code formatted and linted - Manual workflow compilation successful Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- All workflow lock files updated with new footer functionality - No source changes, only generated lock files Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add reference to triggering issue in safe output
Add triggering issue/PR/discussion reference to safe output footers
Oct 15, 2025
Contributor
|
Agentic Changeset Generator triggered by this pull request |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Safe output footers (in issues, comments, and PR review comments) currently only show the workflow name and action run link, but don't reference the triggering issue, pull request, or discussion that caused the workflow to run. This makes it harder to trace the context of AI-generated content.
Previous footer:
> AI generated by [My Workflow](https://github.com/owner/repo/actions/runs/12345)Solution
Enhanced the
generateFooter()function in all three safe output scripts to automatically include a reference to the triggering issue, PR, or discussion when available, using GitHub's reference syntax.New footer (when triggered by issue #42):
> AI generated by [My Workflow](https://github.com/owner/repo/actions/runs/12345) for #42New footer (when triggered by discussion #789):
> AI generated by [My Workflow](https://github.com/owner/repo/actions/runs/12345) for discussion #789Implementation Details
The implementation extracts triggering context from
context.payloadand correctly distinguishes between:context.payload.issue.number(excluding PRs)context.payload.pull_request.numberor detects PRs masquerading as issues viacontext.payload.issue.pull_requestcontext.payload.discussion.numberWhen no triggering context is available (e.g., scheduled workflows, manual triggers), the footer remains unchanged to avoid adding incorrect references.
Files Changed
Source files:
pkg/workflow/js/create_issue.cjs- Updated footer generation for issue creationpkg/workflow/js/add_comment.cjs- Updated footer generation for commentspkg/workflow/js/create_pr_review_comment.cjs- Updated footer generation for PR review commentspkg/workflow/js/create_issue.test.cjs- Added 3 new testspkg/workflow/js/add_comment.test.cjs- Added 2 new testspkg/workflow/js/create_pr_review_comment.test.cjs- Added 1 new testGenerated files:
.lock.ymlfiles automatically recompiled with new footer functionalityTesting
Impact
This enhancement improves traceability of AI-generated content by providing a clear, clickable reference back to the triggering event, making it easier for users to understand the context in which the content was created.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.