Skip to content

feat: comment on linked issues when a release ships#92

Merged
joshjohanning merged 12 commits into
mainfrom
copilot/add-comment-on-linked-issues
Apr 16, 2026
Merged

feat: comment on linked issues when a release ships#92
joshjohanning merged 12 commits into
mainfrom
copilot/add-comment-on-linked-issues

Conversation

Copilot AI commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Adds opt-in comment_on_linked_issues input that comments on closed issues linked to PRs in the release notes when a release is created.

Approach

Instead of regex-based issue parsing (fragile, CodeQL concerns), uses GraphQL closingIssuesReferences to find issues linked via the Development sidebar (Fixes #N, Closes #N keywords):

  1. Parse PR numbers from release notes (/pull/N URLs — GitHub's standard format)
  2. Query GraphQL for each PR's closingIssuesReferences
  3. Filter to closed issues in the same repo (case-insensitive)
  4. Post or update a comment with an HTML marker for idempotency

Key features

  • Idempotent: Uses <!-- publish-github-action-release --> marker. Creates comment on first run, updates if version changes on rerun. Never duplicates.
  • Draft-safe: Works with draft releases — comment gets updated when the release is re-published with a different version.
  • GHES compatible: No hardcoded github.com URLs. Uses GraphQL and REST APIs only.
  • Retry: All API calls wrapped in retryWithBackoff().
  • Case-insensitive: Owner/repo comparison handles GitHub's case insensitivity.

Changes

File Description
src/index.js Replace parseIssueReferences regex with parsePullRequestNumbers + GraphQL. Add idempotent comment posting with marker.
__tests__/index.test.js 4 unit tests for parsePullRequestNumbers, 11 integration tests for linked issues (create, update, skip open, skip cross-repo, case-insensitive, dedup, disabled, no PRs, GraphQL failure, up-to-date skip, release URL).
action.yml Updated comment_on_linked_issues description.
README.md Updated input description, issues: write permission documented.
package.json Version bump 3.0.33.1.0.

Permissions

Requires issues: write when comment_on_linked_issues: true (documented in README).

Tests

73 tests pass. Coverage: 97.24%.

… release

Adds opt-in `comment_on_linked_issues` input that, when enabled, parses
issue references (#N, owner/repo#N, GitHub issue URLs) from the generated
release notes, checks if they are closed issues (not PRs), and posts a
release notification comment on each qualifying issue.

Bumps version to 3.1.0.

Agent-Logs-Url: https://github.com/joshjohanning/publish-github-action/sessions/25438a04-9dea-4bb7-9244-e1dab9ef7f5f

Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Comment thread src/index.js Fixed
Comment thread src/index.js Fixed
Copilot AI changed the title [WIP] Add comment on linked issues when a release ships feat: comment on linked issues when a release ships Apr 15, 2026
Copilot AI requested a review from joshjohanning April 15, 2026 21:29
Replace regex-based issue parsing with GraphQL closingIssuesReferences
query on PRs found in release notes. This:

- Eliminates the CodeQL polynomial-redos finding (no complex regex)
- Uses the Development sidebar linkage (Fixes/Closes keywords) as
  source of truth instead of fragile text parsing
- Adds idempotent comment posting with HTML marker — creates new
  comment or updates existing one (handles reruns, draft→publish,
  version changes)
- Adds retryWithBackoff on GraphQL, listComments, createComment,
  and updateComment calls
- Uses case-insensitive owner/repo comparison
- Works with GHES (no hardcoded github.com in URL parsing)
…ore.debug mock

- Filter marker comments by authenticated user to avoid updating other users' comments
- Paginate closingIssuesReferences GraphQL connection instead of truncating at 50
- Add core.debug to test mock (was missing, causing silent failures)
- Add tests: foreign marker comment ignored, GraphQL pagination across pages
@joshjohanning joshjohanning marked this pull request as ready for review April 16, 2026 01:38
Copilot AI review requested due to automatic review settings April 16, 2026 01:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in feature to comment on closed issues linked to PRs included in GitHub-generated release notes, using GraphQL closingIssuesReferences for robustness across GitHub.com/GHES.

Changes:

  • Add comment_on_linked_issues input and implement PR-number parsing + GraphQL lookup of linked closing issues, posting/updating an idempotent marker comment.
  • Add Jest coverage for PR parsing and end-to-end linked-issue commenting scenarios (create/update/skip/dedupe/failures).
  • Update docs/metadata (action.yml, README permissions) and bump version to 3.1.0 (plus lockfile + coverage badge update).
Show a summary per file
File Description
src/index.js Implements PR extraction, GraphQL issue discovery, and idempotent issue commenting behind a new input flag.
__tests__/index.test.js Adds unit + integration tests for PR parsing and linked-issue comment behavior.
action.yml Adds/updates the comment_on_linked_issues input description.
README.md Documents the new input and required issues: write permission.
package.json Bumps action version to 3.1.0.
package-lock.json Syncs lockfile version fields with package.json.
badges/coverage.svg Updates coverage badge content.

Copilot's findings

  • Files reviewed: 5/7 changed files
  • Comments generated: 3

Comment thread src/index.js Outdated
Comment thread src/index.js
Comment thread src/index.js Outdated
- Fix JSDoc param type to string | null | undefined for parsePullRequestNumbers
- Add description to all retryWithBackoff calls for better diagnostics
- When getAuthenticated fails, create new comment instead of matching any marker

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in feature to this Node.js GitHub Action to comment on closed issues that are linked to pull requests included in the generated release notes, so issue followers get notified when a release ships.

Changes:

  • Add comment_on_linked_issues input and logic to parse PR numbers from release notes and query GraphQL closingIssuesReferences.
  • Post/update an idempotent “shipped in version” comment on linked closed issues using an HTML marker.
  • Expand Jest coverage for PR parsing and linked-issue commenting behavior; update docs and bump version.
Show a summary per file
File Description
src/index.js Implements PR number parsing, GraphQL lookup of linked issues, and idempotent issue commenting.
__tests__/index.test.js Adds unit/integration tests for PR parsing and linked-issue comment behavior.
action.yml Documents the new comment_on_linked_issues input.
README.md Documents the new input and required issues: write permission.
package.json Version bump for new functionality.
package-lock.json Lockfile version sync with package.json.
badges/coverage.svg Updates coverage badge value.

Copilot's findings

  • Files reviewed: 5/7 changed files
  • Comments generated: 1

Comment thread src/index.js
@joshjohanning joshjohanning merged commit 0fc1226 into main Apr 16, 2026
8 checks passed
@joshjohanning joshjohanning deleted the copilot/add-comment-on-linked-issues branch April 16, 2026 02:12
@github-actions

Copy link
Copy Markdown

📦 Draft Release Created

A draft release v3.1.0 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.

Idea: Comment on linked issues when a release ships

4 participants