Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 15, 2025

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 #42

New footer (when triggered by discussion #789):

> AI generated by [My Workflow](https://github.com/owner/repo/actions/runs/12345) for discussion #789

Implementation Details

The implementation extracts triggering context from context.payload and correctly distinguishes between:

  • Issues: Uses context.payload.issue.number (excluding PRs)
  • Pull Requests: Uses context.payload.pull_request.number or detects PRs masquerading as issues via context.payload.issue.pull_request
  • Discussions: Uses context.payload.discussion.number

When 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 creation
  • pkg/workflow/js/add_comment.cjs - Updated footer generation for comments
  • pkg/workflow/js/create_pr_review_comment.cjs - Updated footer generation for PR review comments
  • pkg/workflow/js/create_issue.test.cjs - Added 3 new tests
  • pkg/workflow/js/add_comment.test.cjs - Added 2 new tests
  • pkg/workflow/js/create_pr_review_comment.test.cjs - Added 1 new test

Generated files:

  • All 17 workflow .lock.yml files automatically recompiled with new footer functionality

Testing

  • ✅ All 519 JavaScript tests passing (including 6 new tests for footer functionality)
  • ✅ All Go unit and integration tests passing
  • ✅ Code formatted and linted
  • ✅ All 64 workflows compiled successfully

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

In the safe output issue/pull request footer, that specifies the action run link, a reference should be added to the triggering issue/pr/discussion if any (use GitHub syntax)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits October 15, 2025 06:20
- 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
Copilot AI requested a review from pelikhan October 15, 2025 06:30
@pelikhan pelikhan marked this pull request as ready for review October 15, 2025 10:25
@pelikhan pelikhan merged commit 140b85d into main Oct 15, 2025
5 checks passed
@pelikhan pelikhan deleted the copilot/add-reference-to-triggering-issue-2 branch October 15, 2025 10:25
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request

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.

2 participants