-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug
Description
- Gitea version (or commit ref): 1.11.1 built with GNU Make 4.2.1, go1.13.8
- Git version: 2.24.1
- Operating system: Docker
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- Not relevant
- Log gist: not relevant
Description
I am currently working on a Webhook Event System which should do a specific action every time the labels on a PR have been updated. Currently, it looks like the Webhook configured for the repository is always sending the previous state of the PR to the Webhook endpoint.
So in the example below, I have a PR with the label "bug" assigned, after I've added the label "help wanted", the body of the Webhook only contains the label "bug". If I update the PR again, e.g. adding another label called "feature", the body of the Webhook contains the labels "bug" and "help wanted" (always the previous state before adding or removing a label).
...
"labels": [
{
"id": 8,
"name": "bug",
"color": "ee0701",
"description": "Something is not working",
"url": ""
}
],
...
Screenshots
none
How to reproduce
- Create a small Go application which handles the Webhook and prints out the Webhook body:
package main
import (
"fmt"
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
router.POST("/pull-request", func(c *gin.Context) {
buf := make([]byte, 1024)
num, _ := c.Request.Body.Read(buf)
reqBody := string(buf[0:num])
fmt.Println(reqBody)
c.String(200, "OK")
})
router.Run(":80")
}
- Create a repository and add the endpoint of your running Go application as a Webhook of type "Gitea" to the repository webhooks (e.g.
http://localhost:80/pull-request
) and configure the Webhook to trigger on the custom eventPull Request
. - Create a PR to the repository.
- Add one or more labels to the PR and check the output in the Go application.
Metadata
Metadata
Assignees
Labels
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug