Skip to content

feat: add issue-repo input to comment on issues in another repository - #326

Merged
Ma11hewThomas merged 1 commit into
ctrf-io:mainfrom
uglide:feat/issue-repo-input
Aug 21, 2026
Merged

Ma11hewThomas merged 1 commit into
ctrf-io:mainfrom
uglide:feat/issue-repo-input

Conversation

@uglide

@uglide uglide commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The issue input makes it possible to comment the report on a specific issue or pull request, but the target repository is always the one running the workflow (context.repo). Some setups (like ours at Redis) run tests in a central orchestration repository while the pull requests being tested live in other repositories — for example, we run client-library test suites for the redis clients in a single testing repository, and the results need to land on the client repo's PR. Today that requires a custom script, even though the underlying client functions (addCommentToIssue, updateComment, listComments, deleteComment) already accept owner/repo parameters and GITHUB_TOKEN can already be a PAT with cross-repo access.

Changes

  • New optional issue-repo input (owner/repo format): the repository containing the issue or pull request to comment on. Defaults to the repository running the workflow, so existing behavior is unchanged.
  • Wired only into the issue code path (postOrUpdateIssueComment); the pull-request path is untouched since it is inherently bound to the triggering PR event.
  • New exported resolveIssueRepo helper validates the format and falls back to context.repo; a malformed value surfaces through the existing warning path.
  • Extended the permissions warning to mention that cross-repo commenting needs a token with write access to the target repository.
  • Docs: issue-repo added to the README options block plus a cross-repo usage example.
  • Tests: resolveIssueRepo fallback, override, and malformed-input cases in __tests__/github/handler.test.ts.
  • dist/ rebuilt with npm run package.

Backwards compatibility

issue-repo defaults to '', which resolves to context.repo — identical to current behavior. Comment dedup/update/overwrite (comment-tag, update-comment, overwrite-comment, always-latest-comment) work unchanged since handleComment and the client layer were already repo-parameterized.

npm run check and npm test pass (106 tests).

Allows the issue comment posted via the issue input to target an issue or
pull request in a repository other than the one running the workflow, e.g.
when an orchestration repository runs tests for pull requests that live in
other repositories. Defaults to the current repository, so existing
behavior is unchanged. Requires GITHUB_TOKEN to have write access to the
target repository.
@uglide
uglide marked this pull request as ready for review August 20, 2026 15:10
@Ma11hewThomas
Ma11hewThomas merged commit ab7aec6 into ctrf-io:main Aug 21, 2026
22 checks passed
@Ma11hewThomas

Copy link
Copy Markdown
Contributor

Thank you @uglide, this is a great addition. Released in v1.20

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