From 1e123cfbe5ad7534cf7c099fd21e74293880876b Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Mon, 12 May 2025 16:33:16 -0400 Subject: [PATCH] feat: add ZIZMOR_CONFIG (#789) --- docs/release-notes.md | 5 +++++ docs/snippets/help.txt | 2 +- docs/usage.md | 8 ++++++++ src/main.rs | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index b0963e0a..1afe6d9e 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -22,6 +22,11 @@ of `zizmor`. will redirect to the new one, but users should update any old links to limit confusion +### New Features 🌈 + +* `zizmor` now supports the `ZIZMOR_CONFIG` environment variable as an + alternative to `--config` (#789) + ## v1.7.0 This release comes with **four** new audits: [obfuscation], [stale-action-refs], diff --git a/docs/snippets/help.txt b/docs/snippets/help.txt index 1e788943..e66fbfa6 100644 --- a/docs/snippets/help.txt +++ b/docs/snippets/help.txt @@ -29,7 +29,7 @@ Options: --color Control the use of color in output [possible values: auto, always, never] -c, --config - The configuration file to load. By default, any config will be discovered relative to $CWD + The configuration file to load. By default, any config will be discovered relative to $CWD [env: ZIZMOR_CONFIG=] --no-config Disable all configuration loading --no-exit-codes diff --git a/docs/usage.md b/docs/usage.md index c565ea50..58888915 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -502,6 +502,14 @@ the `--config` argument. With `--config`, the file can be named anything: zizmor --config my-zizmor-config.yml /dir/to/audit ``` +!!! tip + + Starting with `v1.8.0`, you can use the `ZIZMOR_CONFIG` environment + variable to specify a configuration file. + + `ZIZMOR_CONFIG=my-config.yml` is equivalent to + `--config my-config.yml`. + [will discover it]: ./configuration.md#precedence See [Configuration: `rules..ignore`](./configuration.md#rulesidignore) for diff --git a/src/main.rs b/src/main.rs index 2594d699..ec9242ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,7 +89,7 @@ struct App { /// The configuration file to load. By default, any config will be /// discovered relative to $CWD. - #[arg(short, long, group = "conf")] + #[arg(short, long, env = "ZIZMOR_CONFIG", group = "conf")] config: Option, /// Disable all configuration loading.