Skip to content

Update snapshot-if context and functions - #4443

Merged
ericsciple merged 1 commit into
actions:mainfrom
drielenr:drielenr/update-snapshotif-parser
May 21, 2026
Merged

ericsciple merged 1 commit into
actions:mainfrom
drielenr:drielenr/update-snapshotif-parser

Conversation

@drielenr

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings May 20, 2026 20:29
@drielenr
drielenr requested a review from a team as a code owner May 20, 2026 20:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the workflow expression schema and converter to recognize additional contexts and functions in snapshot if conditionals.

Changes:

  • Expanded allowed named-values and functions for snapshot if expressions in the workflow schema JSON.
  • Updated WorkflowTemplateConverter to include additional named values and to enable snapshot condition functions (previously null).
Show a summary per file
File Description
src/Sdk/WorkflowParser/workflow-v1.0.json Extends snapshot if schema context list with additional named values and functions.
src/Sdk/WorkflowParser/Conversion/WorkflowTemplateConverter.cs Adds named values and defines snapshot condition functions for expression parsing/validation.
src/Sdk/DTPipelines/workflow-v1.0.json Mirrors the schema context expansion in the DTPipelines copy.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

@ericsciple
ericsciple merged commit 0b3b8e0 into actions:main May 21, 2026
11 checks passed
jdx added a commit to jdx/jactionlint that referenced this pull request Oct 13, 2026
…e docs do not list (#170)

## What

The `correctness` profile reported keys, values and contexts that GitHub
accepts. Each of them is allowed by the workflow schema of the runner
(`src/Sdk/WorkflowParser/workflow-v1.0.json`) or of the language service
(`actions/languageservices`, `workflow-parser/src/workflow-v1.0.json`),
but the documentation that the generators read does not list them yet. I
checked every item against the schema (and the PR or commit that added
it) before changing anything.

| Item | Source |
| --- | --- |
| top-level `description:` | `workflow-root` of both schemas |
| `cancel-timeout-minutes` on a job (`jobs.<id>.timeout-minutes`
contexts) | `job-factory` of both schemas |
| `types` of `image_version` (`created`, `ready`, `deleted`) |
`image-version-mapping` of both schemas |
| `stacked` for `pull_request` and `pull_request_target` |
languageservices#384 and its schema (the runner schema does not have it
yet) |
| `drives` permission scope (`read`, `write`, `none`) |
languageservices#380 |
| `github.artifacts`, `github.artifacts_list` | github/docs
`contexts.md`, behind the `actions-artifacts-file` flag |
| empty string in the `options` of a `choice` input | languageservices
2934e369 (vscode-github-actions#395). The runner schema still says
non-empty; the dispatch form is the server's, so I followed the language
service |
| `steps`, `job`, `runner`, `env`, `always/cancelled/failure/success`,
`hashFiles` in `snapshot.if` | actions/runner#4443, `snapshot-if` of the
runner schema |
| a 64 digit commit hash is a pinned `uses:` | actions/runner#4347 |

Also:

- `excessive-permissions` skips a level that the scope does not have
(`models: write`). It printed `lets the job , and ...` with an empty
description; `invalid-permissions` already reports the level. `drives`
has a description now. `undocumented-permissions` has no scope table, so
it needed no entry.
- `snapshot.if` is now checked after the steps of the job (like
`outputs`), so `steps.<id>` is typed and a missing step is still
reported.
- The webhook generator has an override table,
`scripts/generate-webhook-events/overrides.go`, with the source of every
entry. It is applied in `run()` after parsing the docs, so `go generate`
keeps `stacked` and the `image_version` types. `all_webhooks.go` has the
same content, which I checked by regenerating from the live docs into a
scratch file (the only difference was `merge_group: destroyed`, which
the docs dropped and which is the other data PR's business and the next
PR's). The `snapshot.if` fallback of the availability generator was
extended the same way; `availability.go` equals what the generator
prints from the live docs.
- `docs/actionlint.md` lists these as places where the checks follow a
newer schema than actionlint 1.7. The `.out` files of the fixtures that
came from actionlint were updated: the key lists in `unexpected key`
messages, and the lines that expected an error for `''` in `options` and
for `env`/`runner` in `snapshot.if`.

Part of #167 (the first "schema drift" checkbox).

## Not done / skipped

- `snapshot.tags`, job-level `success(...)` arguments and the
relaxed-parser keys of the runner schema (item 26 of the research) are
not documented; left for later.
- `repository-projects` no longer documented: low priority, it goes with
the false-negative PR if at all.

## Tests

- `testdata/ok/schema_drift.yaml`: every item above, must stay clean in
the correctness profile.
- `testdata/err/schema_drift_invalid.yaml`: what must still be reported
next to them (an unknown type or level, a duplicated empty option,
`secrets` in `cancel-timeout-minutes`, a missing step in `snapshot.if`).
- `schema_drift_test.go`: types, `snapshot.if` availability,
`snapshot.if` against the steps of the job, excessive-permissions for
`models: write` and `drives: write`, and that every scope with a `write`
level has a description.
- Unit tests for the generator override, the 64 digit pin
(`TestParseUses`, `TestRequireCommitHashOptIn`).
- `go build ./...`, `go vet ./...`, `gofmt -l`, `go test ./...` (the
root package takes about 200 s on this loaded machine) and `go run
./scripts/generate-rules-doc -check` pass. I did not run `go test -race`
or `hk check --all` (the machine was at load 380 from the parallel
agents), and `staticcheck` in this environment fails on export data of
the toolchain.

I did not run a corpus: nothing here adds a finding. Every change makes
the profile accept more.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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