Skip to content

github-action/action-name-casing

Enforce naming convention to action name.

  • 💼 This rule is enabled in the ✅ recommended config.

  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule enforces the consistent case usage of action names.

yaml
name: Unit Test
correct
yaml
# camelCase
name: unitTest
incorrect
yaml
# kebab-case
name: unit-test
incorrect
yaml
# PascalCase
name: UnitTest
incorrect
yaml
# snake_case
name: unit_test
incorrect
yaml
# Train-Case
name: Unit-Test
incorrect
yaml
# SCREAMING_SNAKE_CASE
name: UNIT_TEST
incorrect

🔧 Options

Default casing is set to TitleCase.

ts
type ActionNameCasingOptions = [
  'error' | 'warn' | 'off' | 2 | 1 | 0,
  (
    | 'camelCase'
    | 'kebab-case'
    | 'PascalCase'
    | 'snake_case'
    | 'Title Case'
    | 'Train-Case'
    | 'SCREAMING_SNAKE_CASE'
  ),
]

"Title Case" (default)

Examples of correct code for this rule with default option:

yaml
name: Unit Test

Examples of incorrect code for this rule with default option:

correct
yaml
# camelCase
name: unitTest
incorrect
yaml
# kebab-case
name: unit-test
incorrect
yaml
# PascalCase
name: UnitTest
incorrect
yaml
# snake_case
name: unit_test
incorrect
yaml
# Train-Case
name: Unit-Test
incorrect
yaml
# SCREAMING_SNAKE_CASE
name: UNIT_TEST
incorrect

"kebab-case"

Examples of correct code for this rule with "kebab-case" option:

yaml
name: unit-test

Examples of incorrect code for this rule with "kebab-case" option:

correct
yaml
# camelCase
name: unitTest
incorrect
yaml
# PascalCase
name: UnitTest
incorrect
yaml
# snake_case
name: unit_test
incorrect
yaml
# Title Case
name: unit-test
incorrect
yaml
# Train-Case
name: Unit-Test
incorrect
yaml
# SCREAMING_SNAKE_CASE
name: UNIT_TEST
incorrect

🚀 Version

This rule was introduced in eslint-plugin-github-action v0.0.2

🔍 Implementation