Skip to content

feat(output): add number and context outputs, soft-deprecate issue_number#117

Merged
wadackel merged 1 commit into
mainfrom
feat/issue-100
May 16, 2026
Merged

feat(output): add number and context outputs, soft-deprecate issue_number#117
wadackel merged 1 commit into
mainfrom
feat/issue-100

Conversation

@wadackel
Copy link
Copy Markdown
Collaborator

Summary

Closes #100.

  • Add number output that mirrors issue_number and is named generically for both issue and pull_request contexts.
  • Add context output that emits "issue" or "pull_request", removing the need for downstream steps to recompute context.payload.issue.pull_request != null.
  • Prefix the issue_number description with [Deprecated] and recommend number (documentation-only soft deprecation; the field keeps emitting in v1 and is scheduled for removal in the next major release).
  • Lift the isPr calculation to a single site in run() and pass it into isValidContext, so the validity check and the new context output share one source of truth.
  • Split src/index.ts out as the thin runner that bridges run() to process.exit, and keep src/main.ts side-effect-free so it can be imported from src/main.test.ts without firing the top-level exit path. package.json build script and AGENTS.md entrypoint docs updated accordingly.
  • Add src/main.test.ts with vi.mock based coverage for issue context, pull_request context, and invalid context (none of number / context / issue_number emitted).

Acceptance Criteria (from #100)

  • action.yaml declares number and context outputs.
  • action.yaml description of issue_number is prefixed with [Deprecated] and recommends number.
  • src/main.ts emits number, context, and continues to emit issue_number with the same value.
  • number === issue_number for both issue and pull_request contexts.
  • context === "pull_request" when the comment is on a PR, otherwise "issue".
  • When isValidContext returns false, none of number / context / issue_number are emitted.
  • pnpm build produces an updated dist/, committed in the same PR.
  • pnpm generate is run (README Outputs table regenerated).
  • Tests cover issue context, pull_request context, and invalid context.
  • README Outputs table reflects the new fields and the deprecation note.

Follow-up (out of scope, tracked separately)

  • Harden isValidContext post-condition so the action does not throw before emitting continue=false on malformed issue_comment payloads (currently relies on GitHub-guaranteed payload shape).
  • Regression test for comment.user = null.
  • Coverage for allowed_contexts filtering interaction with the new context output.
  • Physical removal of issue_number (next major release; separate issue/milestone).

References

…mber

Closes #100.

- Add `number` output that mirrors `issue_number` and is named generically
  for both issue and pull_request contexts.
- Add `context` output that emits `"issue"` or `"pull_request"` so consumers
  no longer have to recompute `context.payload.issue.pull_request != null`.
- Prefix the `issue_number` description with `[Deprecated]` and recommend
  `number` (documentation-only; the field keeps emitting in v1 and will be
  removed in the next major release).
- Lift the `isPr` calculation to a single site in `run()` and pass it into
  `isValidContext`, so the validity check and the new `context` output share
  one source of truth.
- Split `src/index.ts` out as the thin runner that bridges `run()` to
  `process.exit`, and keep `src/main.ts` side-effect-free so it can be
  imported from `src/main.test.ts` without firing the top-level exit path.
- Add `src/main.test.ts` with `vi.mock` based coverage for issue context,
  pull_request context, and invalid context (none of `number` / `context` /
  `issue_number` emitted).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wadackel wadackel merged commit f8c6ac0 into main May 16, 2026
3 checks passed
@wadackel wadackel deleted the feat/issue-100 branch May 16, 2026 07:39
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(output): add number and context outputs, soft-deprecate issue_number

1 participant