Skip to content

Accept $/ self repository uses syntax (steps + reusable workflows)#381

Open
nodeselector wants to merge 8 commits into
actions:mainfrom
nodeselector:nodeselector-dollar-self-uses-support
Open

Accept $/ self repository uses syntax (steps + reusable workflows)#381
nodeselector wants to merge 8 commits into
actions:mainfrom
nodeselector:nodeselector-dollar-self-uses-support

Conversation

@nodeselector

@nodeselector nodeselector commented Jul 9, 2026

Copy link
Copy Markdown

Teaches the language service to understand the $/ self repository uses: syntax so the workflow and action editors validate it correctly.

  • Accepts bare $/<path> wherever a same-repository reference is valid: action steps, composite-action steps, and job-level reusable-workflow calls.
  • Rejects $/…@ref — a self repository reference is inherently pinned to the running commit and cannot specify a version.
  • Resolves the target within the same repository, reporting a missing action.yml or an out-of-tree workflow path.

Pairs with the $/ self repository support landing across the parser, launch, and pin tooling.

GitHub Actions is introducing self-referencing `uses:` syntax written
`$/` (e.g. `uses: $/actions/composite`), which resolves an action or
reusable workflow from the same repository as the executing
workflow/action. The language service previously flagged every `$/`
reference as an `invalid-uses-format` error.

- validate-uses.ts: accept `$/<path>` for step uses; error on empty path
  or a trailing `@ref`; keep the reusable-workflow-in-step error.
- validate.ts: accept `$/<path>` for job-level reusable workflows with
  the same rules as local (`./`) references.
- validate-action-reference.ts: resolve `$/` action references against
  the configured FileProvider and require an action.yml/action.yaml;
  skipped when no FileProvider is available.
- action.ts: treat `$/` as a self/local ref in parseActionReference so
  remote metadata resolution is skipped.
- workflow-parser file-reference.ts / steps.ts: parse `$/` as a
  repo-root-relative path and name self-reference step ids "self".
Scope correction: `$/` is only valid for action references in steps
(workflow steps and composite `runs.steps[*].uses`), not for job-level
reusable-workflow calls (`jobs.<id>.uses`). Job-level `$/` stays a
validation error.

- Reverts the `$/` handling in validateWorkflowUsesFormat (validate.ts)
  and in parseFileReference (workflow-parser), so job-level `$/` is
  rejected as before.
- Step-level `$/<path>` now also accepts an optional `@ref`
  (e.g. `$/actions/foo@v1`); the existence check strips the ref before
  resolving the action manifest.
- Tests: assert step-level `$/foo` and `$/foo@v1` are valid, and that a
  job-level reusable-workflow `$/` reference stays invalid.
Per the fleet standard / ADR, a self-reference (`$/<path>`) must not
include a version. A trailing `@ref` (e.g. `$/actions/foo@v1`) is now a
validation error instead of being accepted-and-ignored; the runtime
parser is being fixed to match.
Eric Sciple confirmed the intent is for $/ to work when referencing
reusable workflows at the job level, resolving to this repository at the
running SHA exactly like ./ does for local reusable workflows. This
reverses the earlier rule where any job-level $/ was rejected.

validateWorkflowUsesFormat now treats $/.github/workflows(-lab)/*.yml
like a local reusable-workflow reference: rooted-path, extension, and
top-level checks apply, and a trailing @ref is rejected since a version
is meaningless on a self-reference. parseFileReference resolves $/ to a
local file reference so the referenced workflow can be loaded. Step-level
$/ behavior is unchanged (bare valid, @ref invalid).
Copilot AI review requested due to automatic review settings July 9, 2026 23:43
@nodeselector nodeselector requested a review from a team as a code owner July 9, 2026 23:43

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

Adds support for $/{path} self-referencing uses syntax across the workflow parser and language service so actions and reusable workflows can be referenced within the same repository similarly to ./ local references.

Changes:

  • Accept $/... as a local/self file reference in the workflow parser and normalize it like other local references.
  • Extend languageservice validation to recognize and validate $/... for step uses (actions) and job uses (reusable workflows), including new error cases (empty path, @ref).
  • Add/extend tests covering $/{path} in workflows and actions, including optional resolution via fileProvider.
Show a summary per file
File Description
workflow-parser/src/workflows/file-reference.ts Parses $/... as a local/self file reference.
workflow-parser/src/model/converter/steps.ts Treats $/... like other self/local actions for step id generation.
languageservice/src/utils/validate-uses.ts Adds step-level uses format validation for $/....
languageservice/src/validate-action-reference.ts Adds optional existence checks for self-referenced actions via fileProvider.
languageservice/src/action.ts Excludes $/... from remote action reference parsing.
languageservice/src/validate.ts Adds job-level reusable workflow uses validation for $/....
languageservice/src/validate.uses-format.test.ts Adds workflow/action uses format tests for $/... scenarios.
languageservice/src/validate.self-uses.test.ts New tests validating self action resolution using a fake in-repo FileProvider.
languageservice/src/validate-action.test.ts Adds action validation test for $/' used inside composite action steps.
languageservice/src/action.test.ts Adds parseActionReference coverage for $/' inputs.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 10/10 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread languageservice/src/utils/validate-uses.ts
Comment thread languageservice/src/validate.ts Outdated
Comment thread workflow-parser/src/workflows/file-reference.ts Outdated
Cover the $/ branch added to parseFileReference directly at the parser
level: bare path, empty path, and a fileIdentifier round-trip asserting
$/ normalizes to the same identifier as the equivalent ./ local
reference. Addresses reviewer feedback that the new self-reference
parsing lacked direct unit coverage.
The naming canonical for $/ is "self repository" (it resolves to the
same repository at the running SHA), not "self reference"/"self
referenced". Rename the user-facing diagnostic wording and the internal
helpers accordingly:

- Messages: "self repository references" / "self repository workflows".
- validateSelfUsesFormat -> validateSelfRepositoryUsesFormat.
- validateSelfActionReference -> validateSelfRepositoryActionReference.
- Rename validate.self-uses.test.ts -> validate.self-repository-uses.test.ts
  and update its assertions.

The $/{path} format hint and behavior are unchanged.
@nodeselector nodeselector changed the title Accept $/ self-referencing uses syntax (steps + reusable workflows) Accept $/ self repository uses syntax (steps + reusable workflows) Jul 13, 2026
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.

2 participants