Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Change-Id: If4c7ad81c2a6fd73acabba6cb649edb2ae74587e
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 👀 Review RequirementsThis rule is failing.
🔴 🔎 ReviewsThis rule is failing.
🟠 🤖 Continuous IntegrationWaiting checks:
|
🧪 CI InsightsHere's what we observed from your CI run for 80d65e6. 🟢 All jobs passed!But CI Insights is watching 👀 |
There was a problem hiding this comment.
Pull request overview
This PR enhances the ci scopes CLI command configuration discovery by allowing --config to be supplied via the MERGIFY_CONFIG_PATH environment variable, adding fallback behavior for an explicitly empty env var, and validating the resolved config path.
Changes:
- Add
MERGIFY_CONFIG_PATHas an envvar source forci scopes --config, and disallow directory paths in Click’s path type. - Treat
MERGIFY_CONFIG_PATH=""as “unset” and fall back to auto-detection. - Add a runtime check that the resolved config path points to an existing file, and introduce a regression test for the empty-envvar case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
mergify_cli/ci/cli.py |
Adds envvar support for --config, empty-envvar fallback to autodetect, and explicit config file validation. |
mergify_cli/tests/ci/test_cli.py |
Adds coverage for the MERGIFY_CONFIG_PATH="" autodetection fallback. |
Comments suppressed due to low confidence (2)
mergify_cli/ci/cli.py:257
- The
is_file()check conflates several cases (path doesn’t exist, path exists but is a directory, path exists but isn’t a regular file). The current error message always says "does not exist", which is misleading for directories and can hide the real problem. Consider checking.exists()vs.is_file()and tailoring the ClickException message (or switching toclick.Path(exists=True, dir_okay=False)and letting Click handle the validation/errors).
if not pathlib.Path(config_path).is_file():
msg = f"Config file '{config_path}' does not exist."
raise click.ClickException(msg)
mergify_cli/ci/cli.py:257
- New behavior was added to validate
config_pathand raise aClickExceptionwhen it is missing/not a file, but there’s no test exercising this branch (e.g.--config does-not-exist.ymlorMERGIFY_CONFIG_PATHpointing to a missing path/directory). Adding a regression test would help ensure the new validation and error output stay stable.
if not pathlib.Path(config_path).is_file():
msg = f"Config file '{config_path}' does not exist."
raise click.ClickException(msg)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com