Skip to main content

no-template-placeholder-in-non-template-workflow

Rule catalog ID: R069

Targeted pattern scopeโ€‹

Regular workflow YAML files outside workflow-templates/.

What this rule reportsโ€‹

Reports usage of $default-branch placeholder tokens.

Why this rule existsโ€‹

$default-branch is a template-only token and should not appear in normal workflow files.

โŒ Incorrectโ€‹

on:
push:
branches:
- $default-branch

โœ… Correctโ€‹

on:
push:
branches:
- main

Additional examplesโ€‹

For larger repositories, this rule is often enabled together with one of the published presets so violations are caught in pull requests before workflow changes are merged.

ESLint flat config exampleโ€‹

import githubActions from "eslint-plugin-github-actions-2";

export default [
{
files: ["**/*.{yml,yaml}"],
plugins: {
"github-actions": githubActions,
},
rules: {
"github-actions/no-template-placeholder-in-non-template-workflow": "error",
},
},
];

When not to use itโ€‹

You can disable this rule when its policy does not match your repository standards, or when equivalent enforcement is already handled by another policy tool.

Further readingโ€‹