Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "fatal: bad object" Error #4

Closed
maltfield opened this issue Aug 8, 2024 · 2 comments
Closed

Fix "fatal: bad object" Error #4

maltfield opened this issue Aug 8, 2024 · 2 comments

Comments

@maltfield
Copy link
Owner

This issue will track the effort to fix instances where the unicode workflow fails with the following error

2024-08-07T21:26:01.4155039Z ++ git diff --unified=0 924ca985f8ed2ccec90312e443138dcad45fb35d 10dd695447db03d34ec6caf081f865c056ac5498
2024-08-07T21:26:01.4155223Z ++ grep -E '^[+]'
2024-08-07T21:26:01.4155385Z ++ grep -Ev '^(--- a/|\+\+\+ b/)'
2024-08-07T21:26:01.4155601Z fatal: bad object 10dd695447db03d34ec6caf081f865c056ac5498
2024-08-07T21:26:01.4155733Z + diff=
2024-08-07T21:26:01.4155949Z + '[' 1 -ne 0 ']'
2024-08-07T21:26:01.4156330Z + human_result='WARNING: git diff failed!'
2024-08-07T21:26:01.4156541Z + echo 'WARNING: git diff failed!'
2024-08-07T21:26:01.4156651Z + exit 1
@maltfield
Copy link
Owner Author

maltfield commented Aug 8, 2024

maltfield added a commit that referenced this issue Aug 8, 2024
This commit adds some debugging (to print the full JSON github context vars) and attempts to checkout the head ref before attempting to do a diff. Hopefully this will fix issues of "object not found" because the diff is currently being done in the repo's default branch (main or master), but that won't work if the PR is being submitted to a different branch (eg 'dev') or, maybe, if the PR is being submitted from a different branch.

See also

 * https://stackoverflow.com/questions/70104600/complete-list-of-github-actions-contexts
 * #4
 * BusKill/buskill-app#90 (comment)
@maltfield
Copy link
Owner Author

This is fixed.

It turns out the issue was that it couldn't find the commit because it wasn't in the branch for the user's submitted PR. I fixed it by adding a git fetch and git checkout commands

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

No branches or pull requests

1 participant