Skip to content

Commit a9ee0cf

Browse files
authored
docs: add advanced configuration section for env vars and config file usage (#234)
* docs: add env vars usage for advanced configuration options * docs: move advanced config to dedicated section with ToC entry
1 parent aa0dca3 commit a9ee0cf

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ A GitHub Action for checking commit message formatting, branch naming, committer
2626
* [Optional Inputs](#optional-inputs)
2727
* [GitHub Action Job Summary](#github-action-job-summary)
2828
* [GitHub Pull Request Comments](#github-pull-request-comments)
29+
* [Advanced Configuration](#advanced-configuration)
2930
* [Fork PR Comments](docs/fork-pr-comments.md)
3031
* [Badging Your Repository](#badging-your-repository)
3132
* [Versioning](#versioning)
@@ -164,7 +165,41 @@ jobs:
164165
> ```
165166
> Without `edited`, only the initial title (at PR creation) is validated.
166167

167-
Note: the default rule of above inputs is following [this configuration](https://github.com/commit-check/commit-check-action/blob/main/commit-check.toml). If you want to customize, just add your [`commit-check.toml`](https://commit-check.github.io/commit-check/configuration.html) config file under your repository root directory.
168+
## Advanced Configuration
169+
170+
The [Optional Inputs](#optional-inputs) above cover the most common settings.
171+
For everything else (e.g., `subject-capitalized`, `require-signed-off-by`,
172+
`ai-attribution`, custom `allow-commit-types`, etc.), you have two approaches:
173+
174+
### Via Environment Variables
175+
176+
Set any `CCHK_*` environment variable in your workflow step — no config file required:
177+
178+
```yaml
179+
- uses: commit-check/commit-check-action@v2
180+
env:
181+
CCHK_SUBJECT_CAPITALIZED: "true"
182+
CCHK_REQUIRE_SIGNED_OFF_BY: "true"
183+
CCHK_AI_ATTRIBUTION: "forbid"
184+
CCHK_ALLOW_COMMIT_TYPES: "feat,fix,docs,chore"
185+
```
186+
187+
All available environment variables follow the naming convention:
188+
`CCHK_` + uppercase option name with underscores instead of hyphens. See the
189+
[full mapping](https://commit-check.github.io/commit-check/configuration.html#environment-variables)
190+
in the commit-check documentation.
191+
192+
### Via Configuration File
193+
194+
Add a `commit-check.toml` or `cchk.toml` to the root of your repository.
195+
Refer to the [configuration guide](https://commit-check.github.io/commit-check/configuration.html)
196+
for all available options.
197+
198+
> [!NOTE]
199+
> Configuration priority: **CLI args > environment variables > config file > defaults**.
200+
> The action itself doesn't set any CLI flags beyond those in
201+
> [Optional Inputs](#optional-inputs), so env vars and config files are the
202+
> recommended way to customize.
168203

169204
## GitHub Action Job Summary
170205

0 commit comments

Comments
 (0)