Skip to content

Support cross-repo issue links in check-pr-issue-link#3

Draft
glageju wants to merge 5 commits intomainfrom
chore/support-external-project
Draft

Support cross-repo issue links in check-pr-issue-link#3
glageju wants to merge 5 commits intomainfrom
chore/support-external-project

Conversation

@glageju
Copy link
Copy Markdown
Collaborator

@glageju glageju commented Apr 22, 2026

Closes #5

Summary

  • Extends check-pr-issue-link to recognize cross-repo closing references (e.g. Closes org/repo followed by the number) alongside the existing same-repo form.
  • Each reference is validated against its own owner/repo via the GitHub API; same-repo behavior is unchanged.
  • Per-reference rendering in the warning/heads-up comments: same-repo refs use the bare number form, cross-repo refs include the owner/repo prefix.
  • Unverifiable cross-repo references (typo, private repo, or repo the workflow's GITHUB_TOKEN cannot see) are treated the same as same-repo 404s — reported as not found.

Notable changes

  • LINK_REGEX broadened. The alternation (?:owner/repo#|#?) keeps the hash optional for same-repo refs and required for cross-repo refs in a single pattern.
  • Matches are normalized into { owner, repo, number, isCrossRepo } references, deduped by the full owner/repo/number tuple.
  • README updated with a Supported reference forms section and a cross-repo example.

Test plan

Verified end-to-end in a sandbox caller repo pointing uses: at this branch. All five states produced the expected comment/label:

  • Empty body → Missing Issue Link comment + needs-issue-link label.
  • Same-repo valid reference → comment and label cleared.
  • Cross-repo reference to a nonexistent issue → Invalid Issue Reference comment in the new cross-repo wording; label applied.
  • Mixed (valid same-repo + invalid cross-repo) → Heads-up comment listing only the cross-repo invalid; label removed.
  • Cross-repo valid reference → comment and label cleared.

Note: the PR description intentionally avoids bare issue tokens in prose — the workflow scans all text (including inline code), so any #N or owner/repo#N would be treated as a real reference.

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.

Support cross-repo issue links in check-pr-issue-link

1 participant