Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 15, 2025

Problem

Safe output footers (for issues, comments, PRs, and review comments created by agentic workflows) previously showed only the workflow run link without any reference to what triggered the workflow. This made it difficult to trace back to the originating issue, pull request, or discussion that initiated the workflow execution.

Solution

Updated the footer generation to automatically include a reference to the triggering issue, pull request, or discussion when the workflow is triggered by such events. The reference uses GitHub's native syntax for seamless navigation.

Changes

Modified footer generation across all safe output types:

  • add_comment.cjs: Updated footer to include triggering context for comments
  • create_issue.cjs: Updated footer to include triggering context for new issues
  • create_pr_review_comment.cjs: Updated footer to include triggering context for review comments
  • create_pull_request.cjs: Added inline triggering reference for pull requests

The generateFooter() function now accepts an optional triggeringContext parameter that contains the type (issue/pull_request/discussion) and number of the triggering item.

Footer Examples

Before:

> AI generated by [Workflow Name](https://github.com/owner/repo/actions/runs/12345)

After (issue-triggered):

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

After (PR-triggered):

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

After (discussion-triggered):

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

Benefits

  1. Better Context: Users immediately see which issue/PR/discussion triggered the workflow
  2. Traceability: Direct clickable links to triggering items for audit trails
  3. GitHub Native Syntax: Uses #123 references for issues/PRs (auto-linked by GitHub)
  4. Backward Compatible: No changes when workflow is triggered by other events (push, schedule, etc.)

Testing

  • Added 3 new test cases covering issue, PR, and non-triggering scenarios
  • All 516 JavaScript tests pass
  • All Go unit tests pass
  • TypeScript type checking passes
  • Linting and formatting validated
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)


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

Copilot AI and others added 3 commits October 15, 2025 06:23
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add reference to triggering issue in safe output footer Add triggering issue/PR/discussion reference to safe output footers Oct 15, 2025
Copilot AI requested a review from pelikhan October 15, 2025 06:35
@pelikhan pelikhan closed this Oct 15, 2025
@pelikhan pelikhan deleted the copilot/add-reference-to-triggering-issue branch October 17, 2025 15:16
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