Skip to content

Add four job.workflow_* context properties (fix #647)#696

Open
nikolauspschuetz wants to merge 1 commit into
rhysd:mainfrom
nikolauspschuetz:fix/job-workflow-context-647
Open

Add four job.workflow_* context properties (fix #647)#696
nikolauspschuetz wants to merge 1 commit into
rhysd:mainfrom
nikolauspschuetz:fix/job-workflow-context-647

Conversation

@nikolauspschuetz

Copy link
Copy Markdown

Summary

Fixes #647.

The GitHub Actions runner added four new workflow-identity properties to the job context (actions/runner#4335), now documented in the job context reference:

Expression Description
job.workflow_ref Full ref of the workflow file
job.workflow_sha Commit SHA of the resolved workflow file
job.workflow_repository owner/repo of the workflow file
job.workflow_file_path .github/workflows/file.yml

Because job is modeled as a strict object type, referencing any of these (e.g. ${{ job.workflow_ref }}) was wrongly reported as:

property "workflow_ref" is not defined in object type {check_run_id: number; container: {...}; services: {...}; status: string} [expression]

This PR adds the four string-typed properties so valid workflows are no longer flagged. This follows the same pattern as the recently-added job.check_run_id property (#576).

Testing

  • Added a regression case job.workflow_ref to TestExprSemanticsCheckOK in expr_sema_test.go. It fails on the old code (property reported as undefined) and passes with the fix.
  • go test ./... — all packages pass.
  • go build ./..., go vet ./..., gofmt -l — all clean.
  • Manually confirmed the reproducer (a workflow using all four properties) reports no errors after the fix.

AI assistance

This change was prepared with the help of Claude Code (Anthropic, Opus 4.x). The diff was reviewed and verified locally by the author (build/test/vet/fmt all green; regression test confirmed failing without the fix). The commit carries an Assisted-by: trailer.

The GitHub Actions runner added four new workflow-identity properties to
the `job` context: `job.workflow_ref`, `job.workflow_sha`,
`job.workflow_repository`, and `job.workflow_file_path`. They are now
documented in the "job context" section of the GitHub Actions contexts
reference.

Since `job` is modeled as a strict object type, referencing any of these
properties (e.g. `${{ job.workflow_ref }}`) was wrongly reported as
`property "workflow_ref" is not defined in object type ...`. Add the four
string-typed properties so valid workflows are no longer flagged.

Assisted-by: Claude Code (Anthropic, Opus 4.x)
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.

Four new job.workflow_* context properties

2 participants