Enabling IntelliSense for GitHub Actions workflows in VS Code
If you edit a GitHub Actions workflow in GitHub, you can use auto-completion to quickly know what is possible and detect errors.
I don't often use the GitHub editor. Instead, I prefer to use VS Code to edit my files. By default, VS Code doesn't support IntelliSense for GitHub Actions workflows. But, you can get it using an extension.
First, install the YAML extension developed by Red Hat. Then, you can edit each file to add the following comment:
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Publish Site
on:
# ...
Or you can change the VS Configuration to assign the schema to the GitHub Actions files. Open user or workspaces settings (Ctrl+Shift+P) and select the "Settings (Json)" entry
Then, add the following json to the settings files:
{
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "/.github/workflows/*.yml",
},
}
You can now open a workflow file and use IntelliSense. You can see that the schema is used at the top of the file:
Do you have a question or a suggestion about this post? Contact me!