Summary
Extend outputs so consumers can:
- Read the issue/PR number from a new generic field named
number (rather than issue_number).
- Detect the triggering context (issue vs pull_request) from a new
context output that mirrors the allowed_contexts input vocabulary.
issue_number remains functional in v1 and is marked as deprecated in the description only (soft deprecation). It will be removed in the next major release.
Motivation
issue_number is misleading on pull-request contexts: GitHub assigns the same number space to issues and pull requests, but the field name implies "issue only". Users invoking the command from a PR comment currently have to recall that issue_number also carries the PR number — which is non-obvious.
- The action already accepts an
allowed_contexts input with values issue / pull_request, but there is no output that tells downstream steps which of the two actually triggered the run. Today this requires recomputing context.payload.issue.pull_request != null in user-side script. Exposing it as context removes that duplication.
- Renaming via a parallel field keeps v1 fully backward compatible.
Proposed changes
1. Add number output
- Add a new output
number that emits the value currently emitted by issue_number.
- Source:
context.payload.issue.number.
- Semantics: the issue number for an issue context, and the PR number for a pull_request context (i.e., identical to GitHub's own numbering).
2. Soft-deprecate issue_number
- Keep emitting
issue_number with the same value as today.
- Update its description in
action.yaml to be prefixed with [Deprecated] and to recommend number.
- No runtime warning is emitted. (Documentation-only deprecation.)
- Removal is scheduled for the next major release; tracked separately (see Out of scope).
3. Add context output
- Add a new output
context whose value is "issue" or "pull_request".
- Determination rule:
"pull_request" if context.payload.issue.pull_request != null, else "issue". The existing isPr calculation in isValidContext (src/main.ts:26) is the source of truth — extract it so both call sites use the same logic.
Output emission timing
All three new/changed outputs follow the existing pattern: emitted alongside comment_id / actor / issue_number after isValidContext returns true. This matches the current behavior (these outputs exist when the action proceeds, regardless of whether continue ends up "true" or "false").
Spec details
action.yaml
outputs:
continue: { description: "..." }
params: { description: "..." }
comment_id: { description: "..." }
actor: { description: "..." }
issue_number:
description: '[Deprecated] The issue number of the comment that triggered this action. Use `number` instead. This output will be removed in the next major release.'
number:
description: 'The number of the issue or pull request that triggered this action.'
context:
description: 'The context that triggered this action. One of `"issue"` or `"pull_request"`.'
command: { description: "..." }
src/main.ts
- After
isValidContext passes, additionally set:
core.setOutput('number', context.payload.issue!.number!);
core.setOutput('context', isPr ? 'pull_request' : 'issue');
isPr should be lifted out of isValidContext (or both call sites should call a shared helper) to keep a single source of truth.
README
- Update the Outputs table to include
number and context.
- Mark
issue_number as deprecated and link to number.
Acceptance criteria
Out of scope
- Removal of
issue_number (tracked for the next major release; create a follow-up issue or milestone).
- Emitting a runtime deprecation warning via
core.warning. May be added later if user feedback shows the doc-only deprecation is insufficient.
- Exposing additional issue/PR metadata (title, author, labels, etc.). Defer to a separate request.
- Renaming/expanding
allowed_contexts to match a future event-type taxonomy.
Migration
For consumers of v1:
- run: echo "${{ steps.command.outputs.issue_number }}"
+ run: echo "${{ steps.command.outputs.number }}"
issue_number continues to work in v1; switch at your own pace.
Assumptions
- The Outputs table in
README.md is regenerated by pnpm generate; if not, it must be edited by hand. Confirm during implementation.
- Naming the new output
context is acceptable even though context is also the conventional name of the @actions/github context object in user workflows. Disambiguation lives at the access path (steps.<id>.outputs.context), so no real collision.
- "Next major release" is the right horizon for removing
issue_number. No specific timeline is committed.
References
action.yaml:25-28 — current issue_number and command outputs.
src/main.ts:26 — current isPr computation.
src/main.ts:58-60 — current output emission site for issue_number / comment_id / actor.
- README §Outputs.
Summary
Extend
outputsso consumers can:number(rather thanissue_number).contextoutput that mirrors theallowed_contextsinput vocabulary.issue_numberremains functional in v1 and is marked as deprecated in the description only (soft deprecation). It will be removed in the next major release.Motivation
issue_numberis misleading on pull-request contexts: GitHub assigns the same number space to issues and pull requests, but the field name implies "issue only". Users invoking the command from a PR comment currently have to recall thatissue_numberalso carries the PR number — which is non-obvious.allowed_contextsinput with valuesissue/pull_request, but there is no output that tells downstream steps which of the two actually triggered the run. Today this requires recomputingcontext.payload.issue.pull_request != nullin user-side script. Exposing it ascontextremoves that duplication.Proposed changes
1. Add
numberoutputnumberthat emits the value currently emitted byissue_number.context.payload.issue.number.2. Soft-deprecate
issue_numberissue_numberwith the same value as today.action.yamlto be prefixed with[Deprecated]and to recommendnumber.3. Add
contextoutputcontextwhose value is"issue"or"pull_request"."pull_request"ifcontext.payload.issue.pull_request != null, else"issue". The existingisPrcalculation inisValidContext(src/main.ts:26) is the source of truth — extract it so both call sites use the same logic.Output emission timing
All three new/changed outputs follow the existing pattern: emitted alongside
comment_id/actor/issue_numberafterisValidContextreturnstrue. This matches the current behavior (these outputs exist when the action proceeds, regardless of whethercontinueends up"true"or"false").Spec details
action.yamlsrc/main.tsisValidContextpasses, additionally set:core.setOutput('number', context.payload.issue!.number!);core.setOutput('context', isPr ? 'pull_request' : 'issue');isPrshould be lifted out ofisValidContext(or both call sites should call a shared helper) to keep a single source of truth.README
numberandcontext.issue_numberas deprecated and link tonumber.Acceptance criteria
action.yamldeclaresnumberandcontextoutputs with descriptions above.action.yamldescription ofissue_numberis prefixed with[Deprecated]and recommendsnumber.src/main.tsemitsnumber,context, and continues to emitissue_numberwith the same value as today.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 (matches currentissue_numberbehavior).pnpm buildproduces an updateddist/, committed in the same PR.pnpm generateis run (inputs unchanged, but README Outputs table is regenerated).dist/and generated docs pass.Out of scope
issue_number(tracked for the next major release; create a follow-up issue or milestone).core.warning. May be added later if user feedback shows the doc-only deprecation is insufficient.allowed_contextsto match a future event-type taxonomy.Migration
For consumers of v1:
issue_numbercontinues to work in v1; switch at your own pace.Assumptions
README.mdis regenerated bypnpm generate; if not, it must be edited by hand. Confirm during implementation.contextis acceptable even thoughcontextis also the conventional name of the@actions/githubcontext object in user workflows. Disambiguation lives at the access path (steps.<id>.outputs.context), so no real collision.issue_number. No specific timeline is committed.References
action.yaml:25-28— currentissue_numberandcommandoutputs.src/main.ts:26— currentisPrcomputation.src/main.ts:58-60— current output emission site forissue_number/comment_id/actor.