Webhook: on merge wrong hash in the after field #553

Closed
opened 2025-11-02 03:27:57 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @thomsh on GitHub (Mar 21, 2017).

Description

Hello,

We think we found a problem in the webhook's payload:
When we merge a PR (on the web interface) the payload contain a wrong hash:
In the after field, the hash refer to the last commit in the merged branch instead of the hash of the merge commit.

Droneio then build the destination branch but do reset --hard with the hash fromt he after field.
This introduce multiple problems :

  • we are building a commit with a hash which never existed on this branch.
  • if in the destination branch commits were made after the fork point, they are not included in the build.
  • the merge commit on the destination branch is never build.

If we merge the branch localy and we push, the field after in the payload reference the merge commit: no problem.

On try.gitea.io, we configured a webhook to a bad url, it's not relevant for this test, you can view the payload for the last events.

Other informations:

  • We use Droneio version 4.2 as CI
  • Github always reference the merge commit in the payload.
Originally created by @thomsh on GitHub (Mar 21, 2017). - Gitea version (or commit ref): 1.1.0 - Git version: 2.1.4 - Operating system: (Debian stable) - Database (use `[x]`): - [x] PostgreSQL - Can you reproduce the bug at https://try.gitea.io: - [x] Yes https://try.gitea.io/bidule42/webhook-error-payload/settings/hooks/5 - Log gist: Payload: https://gist.github.com/theznx/5fd861a1a84207ce5655fd48cd8a6a80 ## Description Hello, We think we found a problem in the webhook's payload: When we merge a PR (on the web interface) the payload contain a wrong hash: In the `after` field, the hash refer to the last commit in the merged branch instead of the hash of the merge commit. Droneio then build the destination branch but do `reset --hard` with the hash fromt he `after` field. This introduce multiple problems : - we are building a commit with a hash which never existed on this branch. - if in the destination branch commits were made after the fork point, they are not included in the build. - the merge commit on the destination branch is never build. If we merge the branch localy and we push, the field `after` in the payload reference the merge commit: no problem. On try.gitea.io, we configured a webhook to a bad url, it's not relevant for this test, you can view the payload for the last events. ## Other informations: - We use Droneio version 4.2 as CI - Github always reference the merge commit in the payload.
GiteaMirror added the type/bug label 2025-11-02 03:27:57 -06:00
Author
Owner

@strk commented on GitHub (Mar 22, 2017):

Sounds like milestone should be 1.1.x too

@strk commented on GitHub (Mar 22, 2017): Sounds like milestone should be 1.1.x too
Author
Owner

@lunny commented on GitHub (Mar 22, 2017):

If one bug is on master and effected previous versions, we will mark it last milestone and backport to old version if needed.

@lunny commented on GitHub (Mar 22, 2017): If one bug is on master and effected previous versions, we will mark it last milestone and backport to old version if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#553