User Guide
Requirements
- Node.js
^22.19.0 || >=24.11.0 - ESLint
^9.5.0 || ^10.0.0with flat config
Install
shell
npm i eslint-plugin-github-action -Dshell
yarn add eslint-plugin-github-action -Dshell
pnpm add eslint-plugin-github-action -DBasic Usage
Highly recommended to use eslint.config.mjs as config file.
ts
import { defineConfig } from 'eslint/config'
import pluginGitHubAction from 'eslint-plugin-github-action'
export default defineConfig([
...pluginGitHubAction.configs.recommended,
// Other configs...
])The recommended config already applies to **/.github/workflows/*.yml and .yaml files and sets yaml-eslint-parser.
defineConfig requires ESLint 9.22.0 or later. On ESLint 9.5–9.21, export the config array directly:
ts
import pluginGitHubAction from 'eslint-plugin-github-action'
export default [...pluginGitHubAction.configs.recommended]The recommended preset
The recommended config enables the following rules at error level:
prefer-file-extension defaults to .yml. Override it if your workflows use .yaml.
Advanced Usage
Override recommended rules
Add a config after the recommended preset to override or enable rules:
ts
import { defineConfig } from 'eslint/config'
import pluginGitHubAction from 'eslint-plugin-github-action'
export default defineConfig([
...pluginGitHubAction.configs.recommended,
{
files: ['**/.github/workflows/*.y?(a)ml'],
rules: {
'github-action/prefer-file-extension': ['error', 'yaml'],
'github-action/action-name-casing': ['error', 'kebab-case'],
},
},
])Configure rules manually
To enable only specific rules, register the plugin and YAML parser yourself. Install yaml-eslint-parser as a dev dependency when importing it directly.
See also: ESLint configuration files.
ts
import { defineConfig } from 'eslint/config'
import pluginGitHubAction from 'eslint-plugin-github-action'
import * as parserYAML from 'yaml-eslint-parser'
export default defineConfig([
// Enable only the rules you need
{
name: 'github-action',
files: ['**/.github/workflows/*.y?(a)ml'],
ignores: ['!**/.github/workflows/*.y?(a)ml'],
plugins: {
'github-action': pluginGitHubAction,
},
languageOptions: {
parser: parserYAML,
},
rules: {
'github-action/action-name-casing': ['error', 'kebab-case'],
},
},
])