Visitar URL original
`not found in this repository` when branch renamed before action runs · Issue #1600 · github/codeql-action · GitHub
The Wayback Machine - https://web.archive.org/web/20230327134203/https://github.com/github/codeql-action/issues/1600
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

not found in this repository when branch renamed before action runs #1600

Open
jsoref opened this issue Mar 22, 2023 · 2 comments
Open

not found in this repository when branch renamed before action runs #1600

jsoref opened this issue Mar 22, 2023 · 2 comments

Comments

@jsoref
Copy link
Contributor

jsoref commented Mar 22, 2023

#1572 has the same error message, but is for a more interesting case.

Here, I used github's editor to create a commit, it automatically created a patch-1. That triggered a workflow:

https://github.com/jsoref/pdns/actions/runs/4486688011

Fetching the repository
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +46056980cc77a5a76310b821f7d851913efcb51d:refs/remotes/origin/patch-1

...

ref 'refs/heads/patch-1' not found in this repository

As soon as I created the commit, I visited https://github.com/jsoref/pdns/branches and renamed the branch.

It isn't unreasonable for a flow like this to happen (I wasn't trying to break my own workflow, it's just a flow I take regularly).

Expected results: Ideally the action should be able to find the branch from the point in time when the workflow started and properly resolve things instead of from when the action itself starts running. There's nothing wrong w/ a workflow wanting to have a sarif report about a branch even if the branch is no longer...

@aibaars
Copy link
Collaborator

aibaars commented Mar 22, 2023

Thanks for reporting. This is an interesting corner case.

GitHub Codescanning tracks alerts per branch. For example if a new SARIF file is delivered for a branch then its contents is used to update the status of previously reported alert on the same branch. Codescanning does not use the branch name to resolve commits; when uploading you need to specify both the branch and the commit SHA.

It would be possible for Codescanning to accept SARIF reports for non-existing branches. However, I'm not sure it should. If a user specifies a wrong branch it is probably better to fail, otherwise we'd end up with a confused user that is wondering why they are not seeing any results.

@jsoref
Copy link
Contributor Author

jsoref commented Mar 22, 2023

I think it's worth considering keeping them if the branch previously existed. Obviously if the branch never existed, that'd be a bug on the caller side.

I think for this specific case, that GitHub tracks branch renames is worth keeping in mind.

For patch-1 (or jsoref-patch-1 – both styles are used and I can't explain the logic) and similar, the runs are each going to be tangentially related, but the job run expected the link to be valid because the branch existed when it started.

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

2 participants