Skip to content

Fix workflow_call diff: use GitHub API to detect default branch#18

Merged
gobetti merged 1 commit intomainfrom
fix/workflow-call-base-ref-v3
Mar 4, 2026
Merged

Fix workflow_call diff: use GitHub API to detect default branch#18
gobetti merged 1 commit intomainfrom
fix/workflow-call-base-ref-v3

Conversation

@gobetti
Copy link
Contributor

@gobetti gobetti commented Mar 4, 2026

Summary

  • git symbolic-ref refs/remotes/origin/HEAD returns nothing in Actions (not set by actions/checkout), and sed exits 0 on empty input so the || echo "main" fallback never triggered
  • Replace with a GitHub API call using github.token to reliably get the repo's default_branch

Test plan

  • Trigger via workflow_call from another repo — diff step should complete without fatal: bad revision error
  • Confirm normal pull_request trigger still works

🤖 Generated with Claude Code

📝 Auto-filled

git symbolic-ref fails silently (sed exits 0 on empty input,
masking the fallback). Use the GitHub API with github.token
to reliably get the repo's default branch name instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gobetti gobetti merged commit ca1cd45 into main Mar 4, 2026
1 check 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