A Zed extension for GitHub Actions workflows. It runs GitHub's official language server (@actions/languageserver), the same one behind the VS Code extension, and hands it the repository context it needs to talk to github.com. With that, a secrets.X or vars.X that does not exist is underlined with Context access might be invalid: X, checked against:
- the repository and organization secrets and variables;
- the job's
environment:, when the job has one.
You also get completion, hover and schema validation for workflows.
When a workflow is opened, the extension:
- takes the token from
GH_TOKEN/GITHUB_TOKENin your shell or, failing that, fromgh auth token; - reads the
originremote withgitto find theowner/name; - looks up the repository id and whether it belongs to an organization with
gh api repos/<owner>/<name>.
Without a token or a github.com remote the server still runs, just without the validations that need github.com. The token needs the repo and workflow scopes (the default gh auth login has them).
-
Install the GitHub CLI and log in with
gh auth login. -
Clone this repository and, in Zed, run
zed: install dev extensionfrom the command palette, picking the cloned folder. Zed builds the extension, which needs Rust installed throughrustup. -
Associate workflows with the
GitHub Actionslanguage in your Zedsettings.json, so other YAML files stay YAML: -
Open a workflow. The first time, the extension installs
@actions/languageserverthrough npm.
After creating a secret or variable on GitHub, run editor: restart language server so the server fetches the lists again.
Values in lsp.actions-languageserver.initialization_options override the detected ones, e.g. to use another token or turn on logging:
"lsp": {
"actions-languageserver": {
"initialization_options": { "logLevel": 0 }
}
}The official server skips validation for jobs whose environment is an expression, like environment: production-${{ matrix.cell }} (VS Code behaves the same). For those, scripts/gh-check-env checks every workflow from the command line, expanding the matrix:
cd my-repository && path/to/gh-check-envcargo test # unit tests
cargo build --release --target wasm32-wasip2 # the same build Zed runsRun Zed with zed --foreground or use dev: open language server logs to see the extension and server logs.
GPL-3.0-or-later. The Tree-sitter queries in languages/github-actions/ come from Zed's built-in YAML support, which is licensed under the GPL.