tea pr: showing CI status of merged PR always fails #318

Closed
opened 2020-12-21 19:08:53 +00:00 by noerw · 4 comments
Member

..because pr.Head.Sha is empty on a PR with deleted head branch.

Not sure if we can do something about this. It's weird, because the web UI still has the history, and the CI result is still stored under the original commit.

If we can't fix it, we should handle it better than printing error while loading CI: 404 Not Found

..because `pr.Head.Sha` is empty on a PR with deleted head branch. Not sure if we can do something about this. It's weird, because the web UI still has the history, and the CI result is still stored under the original commit. If we can't fix it, we should handle it better than printing `error while loading CI: 404 Not Found`
noerw added the
kind/bug
label 2020-12-21 19:08:53 +00:00
Owner

This should be a bug of Gitea.

This should be a bug of Gitea.
noerw added the
upstream/gitea
label 2020-12-22 00:03:04 +00:00
Author
Member
upstream issue https://github.com/go-gitea/gitea/issues/12675
Owner

hmm shold I add the workaround into the sdk?
ref: https://github.com/go-gitea/gitea/issues/12675#issuecomment-685903482

hmm shold I add the workaround into the sdk? ref: https://github.com/go-gitea/gitea/issues/12675#issuecomment-685903482
Author
Member

@6543 I don't understand that workaround, how do you query for a commit without the SHA?
Otherwise a workaround would be nice, so things work with older gitea versions

I also noticed that we depend on this gitea bug here (I thought it was intended behaviour ;):

  • // if remote head branch is already deleted, pr.Head.Ref points to "pulls/<idx>/head"
    remoteBranch := pr.Head.Ref
    remoteDeleted := remoteBranch == fmt.Sprintf("refs/pull/%d/head", pr.Index)
    if remoteDeleted {
    remoteBranch = pr.Head.Name // this still holds the original branch name
    fmt.Printf("Remote branch '%s' already deleted.\n", remoteBranch)
    }
  • remoteDeleted := pr.Head.Ref == fmt.Sprintf("refs/pull/%d/head", pr.Index)
    if remoteDeleted {
    return fmt.Errorf("Can't checkout: remote head branch was already deleted")
    }
@6543 I don't understand that workaround, how do you query for a commit without the SHA? Otherwise a workaround would be nice, so things work with older gitea versions I also noticed that we depend on this gitea bug here (I thought it was intended behaviour ;): - https://gitea.com/gitea/tea/src/commit/b5c670ebf8ef207ddec242490a57659edbc49e88/modules/task/pull_clean.go#L39-L45 - https://gitea.com/gitea/tea/src/commit/b5c670ebf8ef207ddec242490a57659edbc49e88/modules/task/pull_checkout.go#L30-L33
6543 self-assigned this 2021-01-21 15:05:30 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/tea#318
No description provided.