Workflow parser rejects documented `cache-mode` key ("Unexpected value 'cache-mode'")

Open Beginner friendly
#397 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
80/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, typescript, yaml
Domain
devtools, tooling

Research direction

Start by reading workflow-parser/src/workflow-v1.0.json, where the issue says the key is missing, and inspect the workflow and job property definitions. Add support for the documented values at both levels, then verify parsing accepts each value and rejects unsupported ones. The issue provides reproduction workflows and the expected values, but names no test file.

Written by the indexing model from the issue text.

Description

Describe the bug
The workflow parser reports Unexpected value 'cache-mode' for the cache-mode key, at both the workflow level and the job level. cache-mode is documented in the workflow syntax reference (top-level and jobs.<job_id>.cache-mode), with values read, write, write-only and none. The runner already handles it (actions/runner#4538), but cache-mode doesn't appear anywhere in workflow-parser/src/workflow-v1.0.json on main.

To Reproduce

  1. With this workflow:
    name: With top-level cache-mode
    cache-mode: read
    on: push
    jobs:
      a:
        runs-on: ubuntu-latest
        steps:
          - run: echo hi
    
    or with cache-mode: write under jobs.a.
  2. Parse it with parseWorkflow from @actions/workflow-parser:
    import { parseWorkflow, NoOperationTraceWriter } from "@actions/workflow-parser";
    const r = parseWorkflow({ name: "wf.yml", content }, new NoOperationTraceWriter());
    console.log(r.context.errors.getErrors().map(e => e.message));
    
  3. See error:
    wf.yml (Line: 2, Col: 1): Unexpected value 'cache-mode'
    wf.yml (Line: 6, Col: 5): Unexpected value 'cache-mode'   # job-level case
    

The same workflows without cache-mode parse with no errors.

Expected behavior
cache-mode is accepted at the workflow and job level, with the value restricted to read, write, write-only or none.

Package/Area

  • Expressions
  • Workflow Parser
  • Language Service
  • Language Server

Package Version
@actions/workflow-parser v0.3.61

Additional context
Since the language service validates with this schema, I'd expect the GitHub Actions VS Code extension to show documented cache-mode usage as an error. Other tools have the same gap: actionlint (rhysd/actionlint#745, #762). SchemaStore's github-workflow.json already accepts it.

Dominant language
TypeScript
Stars
195
Forks
78
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from actions/languageservices

All issues in actions/languageservices

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.