loading...

VSCode, how to check workflow syntax for GitHub Actions

robertobutti profile image Roberto B. ・2 min read

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:

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…

Discussion

pic
Editor guide