Skip to content

feat: issue-PR linking plugin to comment on issues when PRs reference them #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 14, 2025

This PR implements a new plugin that automatically comments on issues when pull requests are created or edited to reference them. This addresses the long-standing request to help issue followers stay informed when discussion moves to a PR.

How it works

The plugin listens for pull_request.opened and pull_request.edited events and uses regex pattern matching to find issue references in PR titles. When it finds patterns like:

It automatically posts a friendly comment on the referenced issues:

👋 Hi! This issue is being addressed in pull request https://github.com/owner/repo/pull/456. Thanks, @contributor!

Safeguards against abuse

To prevent the abuse scenario mentioned in the original issue (PRs with titles like "#1 #2 #3 #4 #5 #6 #7 ..."), several safeguards are implemented:

  1. Keyword requirement: Only recognizes issue references with proper keywords (fix, fixes, close, closes, resolve, resolves)
  2. Maximum limit: Processes at most 3 issues per PR to prevent spam
  3. Duplicate prevention: Won't comment multiple times on the same issue for the same PR
  4. State checking: Only comments on open issues, skipping closed or non-existent ones
  5. Graceful error handling: Continues processing if individual API calls fail

Implementation details

  • New plugin: src/plugins/issue-pr-link/index.js
  • Comprehensive tests: 8 test cases covering all scenarios in tests/plugins/issue-pr-link/index.js
  • Integration: Added to plugin exports and enabled plugins list
  • Code quality: Passes all linting rules and maintains existing test coverage

The regex pattern /(?:fix|fixes|close|closes|resolve|resolves)\s+#(\d+)/giu ensures that random issue numbers (like "#999 in documentation") won't trigger comments without proper context keywords.

Fixes #77.


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

Copy link
Author

Copilot AI commented Aug 14, 2025

@nzakas 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copy link

linux-foundation-easycla bot commented Aug 14, 2025

CLA Not Signed

@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

2 similar comments
@eslint-github-bot
Copy link

Hi @copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@Copilot Copilot AI changed the title [WIP] Comment on an issue when a PR is created to fix it Add issue-PR linking plugin to comment on issues when PRs reference them Aug 14, 2025
Copilot finished work on behalf of nzakas August 14, 2025 16:05
@Copilot Copilot AI requested a review from nzakas August 14, 2025 16:05
@eslint-github-bot
Copy link

Hi @Copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

This actually looks like it should do what we want. Would like another review. @eslint/eslint-team

@nzakas nzakas changed the title Add issue-PR linking plugin to comment on issues when PRs reference them feat: issue-PR linking plugin to comment on issues when PRs reference them Aug 19, 2025
@eslint-github-bot
Copy link

Hi @copilot!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The length of the commit message must be less than or equal to 72

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@nzakas nzakas marked this pull request as ready for review August 19, 2025 14:52
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.

Comment on an issue when a PR is created to fix it
2 participants