Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS code syntax highlighting for GitHub Actions is broken (for me)

I use VS code. I am starting a new project that is using GitHub Actions. I am using Red Hat's YAML extension.

It usually works great. It says that is has support for GitHub Workflows and GitHub Actions. But it is very "confused" regarding what should be highlighted. The code in the screenshot below works - I have deployed successfully - and it is messing up very obvious highlighting. In the screenshot, I am hovering over elements in the env list and you can see that it is saying that environment variables must be booleans. (FWIW, I also tried putting in a boolean and then it complained about it not being a key-value pair, which is actually correct.)

VS Code Screen Capture: Incorrect Syntax Highlighting

It appears that others are also having this problem and there was a suggestion given here that should have fixed it but didn't.

Has anyone else had trouble setting up GitHub Actions syntax highlighting?

like image 796
Mike Williamson Avatar asked Sep 12 '25 23:09

Mike Williamson


1 Answers

For anyone else who finds their way here, this is, apparently, intended behavior. Adding support for Actions isn't on GitHub's roadmap for the plugin at the time of writing.

As a workaround, you can manually set the language mode to GitHub Actions Workflow which will at least get you syntax highlighting. It won't get you autocomplete, though.

Update 2024-05-29

After spending a few weeks working a lot with Actions and Workflows I would not recommend using Workflow syntax when writing composite actions. The syntax between the two is subtly different, and you're likely to make mistakes if you use the wrong highlighter.

For example, if Intellisense thinks you're working on a Workflow, it won't be able to tell you that jobs, env, and secrets are invalid keys on an Action.

like image 105
nronnei Avatar answered Sep 15 '25 13:09

nronnei