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

Error: "Not Found" when pushing a new branch #12

Open
seahindeniz opened this issue Oct 25, 2021 · 2 comments
Open

Error: "Not Found" when pushing a new branch #12

seahindeniz opened this issue Oct 25, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@seahindeniz
Copy link

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

@Ana06
Copy link
Owner

Ana06 commented Oct 27, 2021

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)

@Ana06 Ana06 added the bug Something isn't working label Oct 27, 2021
@Jolg42
Copy link

Jolg42 commented Jan 13, 2022

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 ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants