Skip to content

feat(ci): add --config option and MERGIFY_CONFIG_PATH envvar to scopes#1001

Closed
sileht wants to merge 1 commit intomainfrom
devs/sileht/allow-to-pass-config-file/If4c7ad81c2a6fd73acabba6cb649edb2ae74587e
Closed

feat(ci): add --config option and MERGIFY_CONFIG_PATH envvar to scopes#1001
sileht wants to merge 1 commit intomainfrom
devs/sileht/allow-to-pass-config-file/If4c7ad81c2a6fd73acabba6cb649edb2ae74587e

Conversation

@sileht
Copy link
Member

@sileht sileht commented Mar 5, 2026

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change-Id: If4c7ad81c2a6fd73acabba6cb649edb2ae74587e
Copilot AI review requested due to automatic review settings March 5, 2026 13:43
@mergify mergify bot had a problem deploying to Mergify Merge Protections March 5, 2026 13:43 Failure
@mergify
Copy link
Contributor

mergify bot commented Mar 5, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 👀 Review Requirements

This rule is failing.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🔴 🔎 Reviews

This rule is failing.
  • #review-requested = 0
  • #changes-requested-reviews-by = 0
  • #review-threads-unresolved = 0

🟠 🤖 Continuous Integration

Waiting checks: ci-gate.
  • all of:
    • check-success=ci-gate

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?:

🟢 📕 PR description

Wonderful, this rule succeeded.
  • body ~= (?ms:.{48,})

@sileht sileht closed this Mar 5, 2026
@sileht sileht deleted the devs/sileht/allow-to-pass-config-file/If4c7ad81c2a6fd73acabba6cb649edb2ae74587e branch March 5, 2026 13:43
@mergify
Copy link
Contributor

mergify bot commented Mar 5, 2026

🧪 CI Insights

Here's what we observed from your CI run for 80d65e6.

🟢 All jobs passed!

But CI Insights is watching 👀

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_PATH as an envvar source for ci 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 to click.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_path and raise a ClickException when it is missing/not a file, but there’s no test exercising this branch (e.g. --config does-not-exist.yml or MERGIFY_CONFIG_PATH pointing 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants