Skip to content

Restore GitHub action output schema dispatch - #6308

Merged
madskristensen merged 2 commits into
SchemaStore:masterfrom
TWiStErRob:fix/github-action-output-schema-dispatch
Sep 4, 2026
Merged

Restore GitHub action output schema dispatch#6308
madskristensen merged 2 commits into
SchemaStore:masterfrom
TWiStErRob:fix/github-action-output-schema-dispatch

Conversation

@TWiStErRob

@TWiStErRob TWiStErRob commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Restore runtime-dependent validation for action outputs after #6270 moved the discriminator into output definitions, where runs refers to an output identifier rather than the top-level action runtime.

Cause

#6270 replaced top-level if / then / else dispatch with dependencies nested inside each output definition. Dependencies evaluate the current output map, so runs is interpreted as an output identifier and cannot inspect top-level runs.using. The remaining undiscriminated oneOf allows the standard and composite output schemas to overlap.

The first commit adds four regression fixtures and records the verbatim failures produced when each fixture is tested independently on master. The second commit restores top-level if / then / else dispatch based on runs.using, with the object type required by AJV strict validation.

This restores these behaviors:

  • Empty output maps are valid.
  • runs is a valid output identifier.
  • JavaScript outputs cannot declare composite-only value.
  • Composite outputs require value.

AI-generated (GPT-5.6 Sol), session: 735ab2c3-5ca6-4a29-815a-614392508b98 in schemastore.

TWiStErRob and others added 2 commits September 4, 2026 19:06
Each fixture was added individually on top of master, then tested with:

    node ./cli.js check --schema-name=github-action.json

`outputs-empty.json`:

    >> Failed to validate file "src/test/github-action/outputs-empty.json" against schema file "./src/schemas/json/github-action.json"
    >> Showing first error out of 1 total error(s)
    {
      instancePath: '/outputs',
      schemaPath: '#/properties/outputs/oneOf',
      keyword: 'oneOf',
      params: { passingSchemas: [ 0, 1 ] },
      message: 'must match exactly one schema in oneOf'
    }

`output-id-runs.json`:

    >> Failed to validate file "src/test/github-action/output-id-runs.json" against schema file "./src/schemas/json/github-action.json"
    >> Showing first error out of 3 total error(s)
    {
      instancePath: '/outputs',
      schemaPath: '#/definitions/outputs-composite/dependencies/runs/required',
      keyword: 'required',
      params: { missingProperty: 'using' },
      message: "must have required property 'using'"
    }

`javascript-output-with-value.json`:

    >> Schema validation succeeded for test file "./src/negative_test/github-action/javascript-output-with-value.json", but was supposed to fail
    >> For schema "./src/schemas/json/github-action.json"

`composite-output-missing-value.json`:

    >> Schema validation succeeded for test file "./src/negative_test/github-action/composite-output-missing-value.json", but was supposed to fail
    >> For schema "./src/schemas/json/github-action.json"

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The strict-validation rewrite moved runtime-dependent output selection into
`dependencies` nested under each output definition. At that level, `runs`
means an output identifier rather than the top-level action runtime, so the
schema cannot distinguish composite outputs from JavaScript or Docker outputs.

Restore top-level `if` / `then` / `else` dispatch based on `runs.using`. Keep
the placeholder `outputs` property required by draft-07
`additionalProperties: false`, and declare the nested `runs` condition as an
object so AJV strict type validation still passes.

This makes empty output maps and output IDs named `runs` valid again, rejects
JavaScript outputs containing composite-only `value`, and requires `value` for
composite outputs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@TWiStErRob
TWiStErRob marked this pull request as ready for review September 4, 2026 18:13
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR!

This section of the codebase is owned by @madskristensen and @hyperupcall - if they write a comment saying "LGTM" then it will be merged.

@TWiStErRob

Copy link
Copy Markdown
Contributor Author

@Vessel9817 please take a look in case the fixes are incorrect.

@madskristensen

Copy link
Copy Markdown
Contributor

Thanks!

@madskristensen
madskristensen merged commit acc1b65 into SchemaStore:master Sep 4, 2026
6 checks passed
@Vessel9817

Copy link
Copy Markdown
Contributor

Not familiar with using composite actions, but LGTM

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.

3 participants