no-required-input-with-default
Rule catalog ID: R047
Targeted pattern scopeโ
Action metadata inputs.<id> definitions.
What this rule reportsโ
Reports input definitions that set both required: true and default.
Why this rule existsโ
A default value means callers can omit the input, which conflicts with required: true.
โ Incorrectโ
inputs:
token:
description: Token
required: true
default: abc123
โ Correctโ
inputs:
token:
description: Token
required: true
Behavior and migration notesโ
This rule offers two suggestions rather than an autofix because both outcomes can be valid:
- remove
required: trueand keep the default value, or - remove the default value and keep the input required.
Choose the suggestion that matches how callers are meant to supply the input.
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-required-input-with-default": "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.