VSCode, how to check workflow syntax for GitHub Actions
Creating a workflow for GitHub Action is quite easy. You need to understand how the “GitHub Workflow” process works and then you need to create a Yaml file to define your workflow configuration.
You could start from:
- The official documentation about how to create your workflow Yaml file https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
- A workflow template: https://github.com/actions/starter-workflows/tree/master/ci . This is the repository filled and maintained by the community where you could find some starter template for your language and/or framework.
So, once you are able to start to write your workflow Yaml file, probably you would need a support in your editor, while you are creating/editing your Yaml file. A good support from your editor would be: suggest and show some directive description while you are typing and check the syntax and notify you if you are doing some error (typo, wrong directive etc).
JSON Schema project
JSON Schema project http://schemastore.org/json/ wants to be a repository to include schemas for all commonly known JSON file formats.
A schema is like a descriptor useful if you want to automate the check of your JSON file. We have a lot of JSON schema, and we have also a schema for GitHub actions.
Hey! Wait! Our workflow file is a Yaml file, it is not a JSON file! So, how could we use the JSON Schema????????
Install the right extension in VSCode
In order to use the JSON Schema with our Yaml file we need to install a Extension in our editor. This extension convert on the fly the Yaml that we are editing in a Json file and performs the check with the JSON Schema.
If you are using Visual Studio Code (VSCode) you can install this extension: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
Once your extension is installed you can jump back into your Yaml File and you can start typing…