A "changed files" step runs `git diff --name-only ${{ github.event.before }} HEAD` and fails with `fatal: bad object 0000000000000000000000000000000000000000`.
AdvancedTroubleshootingGitHub, Actions and Pull Request Issues
Answer
Likely causes → On the first push of a new branch, github.event.before is all zeros. After a force-push it is a SHA that no longer exists in the remote, and with a shallow clone the old commit is never present locally either (fatal: bad object <sha>).
Diagnose → echo "${{ github.event.before }}" and git rev-parse --is-shallow-repository.
Fix → Handle these cases explicitly:
BEFORE="${{ github.event.before }}"
if [ "$BEFORE" = "0000000000000000000000000000000000000000" ] || ! git cat-file -e "$BEFORE^{commit}" 2>/dev/null; then
git fetch --no-tags origin main
BEFORE=$(git merge-base origin/main HEAD)
fi
git diff --name-only "$BEFORE" HEAD
Use fetch-depth: 0 (or enough depth) so the base commit exists.
Prevent → Prefer comparing against the merge base with the default branch over event.before.
More on GitHub, Actions and Pull Request Issues
A workflow step that pushes a version bump fails with `remote: Permission to org/repo.git denied to github-actions[bot].` and `The requested URL returned error: 403`.IntermediateA workflow pushes a commit or tag, but the workflow that should run on that push or tag never starts.IntermediateA container job fails on any Git command with `fatal: detected dubious ownership in repository at '/__w/app/app'`.IntermediateYour PR suddenly shows 340 changed files and dozens of commits you did not write.IntermediateThe PR is stuck on `Expected — Waiting for status to be reported` for a required check called `build`.IntermediateThe PR was approved, but merging shows "Review required" again after you pushed a small fix.Beginner