Validating Github Actions Workflow files in Jetbrains IDEs

Β·

2 min read

If you maintain projects on Github, you must have come across Github Actions - which is Github's own CI provider where you can greate workflow files in .github/workflow/<xyz>.yml and get Github to build your project, run lint, test PRs, deploy to releases etc.

I use Github Actions extensively, mainly for my opensource projects as Github gives you unlimited free tier build minutes for OSS repos. And I prefer having a full end-to-end CI setup on my projects so it makes it easier for me to review and merge PRs.

Anyway, one problem I used to face is absence of validation of the workflow.yml files when working on IDEs. Visual Studio code does seem to have some plugins which can validate Github Workflow files, but on Jetbrains IDEs (IntelliJ IDEA, Webstorm, GoLand etc) there isn't something like that.

But SchemaStore does have JSON Schema definitions for Github Actions. Which we can use to validate our workflow files. Here's how-

Add JSON Schema for Github Workflow in IDE Settings

Go here in Preferences

  • Preferences

    • Languages & Frameworks

      • JSON Schema Mappings

Add a new JSON Schema Mapping.

Give it a name, like github-workflow

Add this as the path to the JSON Schema https://json.schemastore.org/github-workflow.json (you can click the 🌍 globe icon and search "Github Workflow" in the SchemaStore list too).

Now we need to add a file pattern, to tell the IDE which files to be validated with this JSON Schema. Add this file pattern

.github/workflows/*.yml

And voila.... schema validation shoud start working

You'll also get auto-complete and descriptions of the keys when you edit Github Workflow files now.

Β