Skip to content

Fix GitHub Actions coverage badge workflow git operations#276

Closed
talgalili wants to merge 1 commit intofacebookresearch:mainfrom
talgalili:export-D90937254
Closed

Fix GitHub Actions coverage badge workflow git operations#276
talgalili wants to merge 1 commit intofacebookresearch:mainfrom
talgalili:export-D90937254

Conversation

@talgalili
Copy link
Contributor

Summary:
The coverage badge workflow was failing in GitHub Actions when the remote badges branch didn't exist. The flawed conditional logic would create an orphan branch but then fail on the subsequent checkout.

This fix uses an idempotent approach that always creates a fresh orphan branch and force-pushes to the remote, avoiding racy conditional checks and working reliably whether the remote branch exists or not.

Differential Revision: D90937254

Summary:
The coverage badge workflow was failing in GitHub Actions when the remote `badges` branch didn't exist. The flawed conditional logic would create an orphan branch but then fail on the subsequent checkout.

This fix uses an idempotent approach that always creates a fresh orphan branch and force-pushes to the remote, avoiding racy conditional checks and working reliably whether the remote branch exists or not.

Differential Revision: D90937254
Copilot AI review requested due to automatic review settings January 18, 2026 09:40
@meta-codesync
Copy link

meta-codesync bot commented Jan 18, 2026

@talgalili has exported this pull request. If you are a Meta employee, you can view the originating Diff in D90937254.

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 fixes a flawed conditional in the coverage badge GitHub Actions workflow that would fail when the remote badges branch didn't exist. The solution replaces racy conditional checks with an idempotent approach: always create a fresh orphan branch locally and force-push it to the remote.

Changes:

  • Replace conditional fetch/create logic with unconditional orphan branch creation
  • Add a README.md to the badges branch for documentation
  • Use force-push to reliably update the remote badges branch regardless of its prior state

git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]"
git push origin badges
git add .
git commit -m "Update coverage badge to ${COVERAGE}% [skip ci]"
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

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

The commit message uses variable interpolation syntax ${COVERAGE} but it's inside single quotes in the git commit command, which prevents shell variable expansion. The commit message will literally contain the string "${COVERAGE}%" instead of the actual coverage percentage value. Either use double quotes around the entire message or use "Update coverage badge to $COVERAGE% [skip ci]" to ensure proper variable expansion.

Copilot uses AI. Check for mistakes.
@meta-codesync
Copy link

meta-codesync bot commented Jan 18, 2026

This pull request has been merged in fe135c3.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants