Error: "Not Found" when pushing a new branch
Opened this issue · 2 comments
Hi @Ana06, do you think it's possible to have a solution for this issue?
jitterbit#10
It also appears on this fork as well
The error is coming from the github api as the commit id is 0000000000000000000000000000000000000000. It may be possible to use the branch name in this case. I would need to try it out, but not sure when I'll have time.
There is a workaround here: trilom/file-changes-action#116 (comment)
I also got into this and was so confused because it was working on one project but not another one and I found out how to handle it:
It seems the source code is here https://github.com/jitterbit/get-changed-files/blob/master/src/main.ts#L28-L36
The code handles 2 different events from GitHub Actions push
& pull_request
.
- When creating a new branch for a PR, push will be triggered immediately before the PR gets created
- The GitHub API / GitHub context base commit is then 0000000000000000000000000000000000000000
- The get-changed-files action needs to have a non 0/empty base commit to be able to diff
- Defining both push (and specify the branches) and pull_request solves the problem
Example
on:
push:
branches:
# Push events our default branch
- main
# Push events to branches matching refs/heads/renovate/...
- 'renovate/**'
pull_request:
paths-ignore:
- '*.md'
- 'renovate.json'
It makes sense to me as a new branch does not have a base / reference where it's from, it's "floating" around, it's when creating the PR that the base branch is selected.
A solution could be to always diff on the default branch, another could be to document this ⬆️