tree-sitter-ghactions

Crates.iotree-sitter-ghactions
lib.rstree-sitter-ghactions
version0.2.2
created_at2025-07-26 21:00:54.825926+00
updated_at2025-09-23 02:51:10.904981+00
descriptionParser for Github Actions expressions
homepage
repositoryhttps://github.com/rmuir/tree-sitter-ghactions
max_upload_size
id1769461
size131,970
Robert Muir (rmuir)

documentation

README

tree-sitter-ghactions

Github Actions expressions grammar for tree-sitter

Features

  • Parses Github Action's expressions: ${{ ... }}
  • Plays well with bash injections in YAML documents
  • Passes parsing tests from actionlint

Neovim Installation (for use in your editor)

  1. Install nvim-treesitter

It is recommended to install at least yaml, bash, and comment parsers to support github actions files.

  1. Configure autocmd for a custom parser:
-- custom parsers
vim.api.nvim_create_autocmd('User', {
  pattern = 'TSUpdate',
  callback = function()
    require('nvim-treesitter.parsers').ghactions = {
      install_info = {
        url = 'https://github.com/rmuir/tree-sitter-ghactions',
        queries = 'queries',
      },
    }
  end,
})
  1. Configure yaml injection in ~/.config/nvim/queries/yaml/injections.scm:
; extends

; github actions
([
  (string_scalar)
  (block_scalar)
  (double_quote_scalar)
  (single_quote_scalar)
] @injection.content
  (#lua-match? @injection.content "[$]{{.*}}")
  (#set! injection.language "ghactions"))
  1. Run :TSUpdate and :TSInstall ghactions from neovim.

NOTE: these instructions are based upon the main branch of nvim-treesitter.

Bindings Installation (for development)

Bindings are published to pypi, npm, and crates.io as tree-sitter-ghactions. Wasm and source code artifacts are published to GitHub releases

Screenshot of highlights

Syntax highlighting screenshot

Commit count: 69

cargo fmt