feat(output): add number and context outputs, soft-deprecate issue_number#117
Merged
Conversation
…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>
|
🎉 This PR is included in version 2.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #100.
numberoutput that mirrorsissue_numberand is named generically for both issue and pull_request contexts.contextoutput that emits"issue"or"pull_request", removing the need for downstream steps to recomputecontext.payload.issue.pull_request != null.issue_numberdescription with[Deprecated]and recommendnumber(documentation-only soft deprecation; the field keeps emitting in v1 and is scheduled for removal in the next major release).isPrcalculation to a single site inrun()and pass it intoisValidContext, so the validity check and the newcontextoutput share one source of truth.src/index.tsout as the thin runner that bridgesrun()toprocess.exit, and keepsrc/main.tsside-effect-free so it can be imported fromsrc/main.test.tswithout firing the top-level exit path.package.jsonbuild script andAGENTS.mdentrypoint docs updated accordingly.src/main.test.tswithvi.mockbased coverage for issue context, pull_request context, and invalid context (none ofnumber/context/issue_numberemitted).Acceptance Criteria (from #100)
action.yamldeclaresnumberandcontextoutputs.action.yamldescription ofissue_numberis prefixed with[Deprecated]and recommendsnumber.src/main.tsemitsnumber,context, and continues to emitissue_numberwith the same value.number === issue_numberfor both issue and pull_request contexts.context === "pull_request"when the comment is on a PR, otherwise"issue".isValidContextreturnsfalse, none ofnumber/context/issue_numberare emitted.pnpm buildproduces an updateddist/, committed in the same PR.pnpm generateis run (README Outputs table regenerated).Follow-up (out of scope, tracked separately)
isValidContextpost-condition so the action does not throw before emittingcontinue=falseon malformedissue_commentpayloads (currently relies on GitHub-guaranteed payload shape).comment.user = null.allowed_contextsfiltering interaction with the newcontextoutput.issue_number(next major release; separate issue/milestone).References
numberandcontextoutputs, soft-deprecateissue_number#100