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

MergePullRequest fails to trigger action #32335

Closed
Fratee opened this issue Oct 24, 2024 · 12 comments · Fixed by #32705
Closed

MergePullRequest fails to trigger action #32335

Fratee opened this issue Oct 24, 2024 · 12 comments · Fixed by #32705
Labels
topic/gitea-actions related to the actions of Gitea type/bug
Milestone

Comments

@Fratee
Copy link

Fratee commented Oct 24, 2024

Description

When merging a pull request the related actions that should trigger on:

on:
  pull_request:
    types: [review_requested]

do not start and the gitea instance throws the following error:

[E] an error occurred while executing the MergePullRequest actions method: gitRepo.GetRefCommitID: object does not exist [id: 32e9eaa99d775bb8922a6ac354a2c9b3dcfe834b, rel_path: ]

This was working fine on 1.22.1

Gitea Version

1.22.2 and 1.22.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.46.0.windows.1

Operating System

Windows 10

How are you running Gitea?

Self hosted on Windows

Database

None

@Zettat123 Zettat123 added the topic/gitea-actions related to the actions of Gitea label Oct 24, 2024
@Zettat123
Copy link
Contributor

The use of gitRepo.GetRefCommitID was introduced by #31875. But I cannot reproduce this issue. Could you provide some detailed steps to reproduce it?

@lunny
Copy link
Member

lunny commented Oct 25, 2024

Wouldn't this workflow be triggered only when some code review requested?

@Zettat123
Copy link
Contributor

Zettat123 commented Oct 25, 2024

Wouldn't this workflow be triggered only when some code review requested?

Yes. But this error occurs before detecting workflows.

commitID, err := gitRepo.GetRefCommitID(ref.String())
if err != nil {
return fmt.Errorf("gitRepo.GetRefCommitID: %w", err)
}
// Get the commit object for the ref
commit, err := gitRepo.GetCommit(commitID)
if err != nil {
return fmt.Errorf("gitRepo.GetCommit: %w", err)
}
if skipWorkflows(input, commit) {
return nil
}
var detectedWorkflows []*actions_module.DetectedWorkflow
actionsConfig := input.Repo.MustGetUnit(ctx, unit_model.TypeActions).ActionsConfig()
workflows, schedules, err := actions_module.DetectWorkflows(gitRepo, commit,

@Fratee
Copy link
Author

Fratee commented Oct 25, 2024

I have branch protection and the pull request has been reviewed before merging. The author of the pull request is merging from the gitea interface.

I can share the repo settings and the pipeline trigger. Is this enough?

@Zettat123
Copy link
Contributor

I'd like to know some details about that PR.

  1. Was this PR created from a fork?
  2. What merge style did you use?
  3. Did you merge this PR successfully?
  4. Can you reproduce the bug on your Gitea?

@Fratee
Copy link
Author

Fratee commented Oct 25, 2024

  1. No. From a branch in the same repository.
  2. Merge with merge commit.
  3. Yes but every action connected to the pull merged event did not trigger.
  4. Yes, on my self hosted gitea. I've now reverted to 1.22.1 but I can make more tests if you need. For the demo website it takes more time as I need to register a runner also.

@Zettat123
Copy link
Contributor

Are there any workflows that are triggered by other events (like "push")? Can these workflows be triggered properly?

@Fratee
Copy link
Author

Fratee commented Oct 29, 2024

Push and other events trigger correctly

@Fratee
Copy link
Author

Fratee commented Nov 27, 2024

Just updated to gitea-1.22.4-windows-4.0-amd64.exe
This version is working fine.

The issue is still present in the GoGit 1.22.4 version

@Zettat123
Copy link
Contributor

The issue is still present in the GoGit 1.22.4 version

Are the versions(1.22.2 and 1.22.3) where you encountered the error also GoGit versions?

@Fratee
Copy link
Author

Fratee commented Nov 30, 2024

@Zettat123 yes, where gogit versions

@Zettat123
Copy link
Contributor

I can reproduce this issue on the GoGit version so I think it's related to GoGit. I'll try to create a PR to fix it.

@lunny lunny added this to the 1.22.5 milestone Dec 4, 2024
silverwind pushed a commit that referenced this issue Dec 4, 2024
Backport #32705 by @Zettat123

Fix #32335

When we call `GetRefCommitID` and the reference is already a commit ID,
the `GetRefCommitID` with go-git will return a `NotExist` error. This PR
improves the `GetRefCommitID` for go-git. If the input is already a
commit ID, it will be returned directly.

Co-authored-by: Zettat123 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gitea-actions related to the actions of Gitea type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants