Skip to content

fix(validate): Use GITHUB_BASE_REF when set so CI validates against PR base#34

Merged
EspenAlbert merged 4 commits intomainfrom
validate-base-branch-fix
Mar 11, 2026
Merged

fix(validate): Use GITHUB_BASE_REF when set so CI validates against PR base#34
EspenAlbert merged 4 commits intomainfrom
validate-base-branch-fix

Conversation

@EspenAlbert
Copy link
Owner

@EspenAlbert EspenAlbert commented Mar 1, 2026

Summary

validate-no-changes now uses the GITHUB_BASE_REF environment variable when set and -b is not passed. In GitHub Actions this is set to the PR base branch on pull_request events, so validation compares the working tree against the correct base (e.g. develop) instead of always main.

Why: PRs that target a non-main branch were incorrectly compared against main, causing false failures or missed checks (issue #33).

How: The --branch option in path_sync._internal.cmd_validate has envvar="GITHUB_BASE_REF". Docs and help text were updated.

Reviewer notes: No breaking change. Explicit -b still overrides the env. Workflows that set GITHUB_BASE_REF (e.g. ${{ github.base_ref || 'main' }}) and run validate-no-changes without -b now get correct behavior. When using GITHUB_BASE_REF, set it to a non-empty branch name.

@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.58%. Comparing base (8edafab) to head (d68e284).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
+ Coverage   65.55%   68.58%   +3.03%     
==========================================
  Files          24       24              
  Lines        1344     1372      +28     
==========================================
+ Hits          881      941      +60     
+ Misses        463      431      -32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Updated `path-sync validate-no-changes` command to accept branch names from the environment variable `GITHUB_BASE_REF`.
- Modified documentation to clarify branch handling in CI.
- Added tests for `validate_no_changes` and `parse_skip_sections` functions to ensure correct behavior.
- Improved logging for validation process.
@EspenAlbert EspenAlbert changed the title todo update me with the PR title for branch validate-base-branch-fix fix(validate): Use GITHUB_BASE_REF when set so CI validates against PR base Mar 1, 2026
@EspenAlbert EspenAlbert marked this pull request as ready for review March 1, 2026 07:40
@EspenAlbert EspenAlbert merged commit ee6e0a6 into main Mar 11, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants