1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-11-23 21:44:44 +02:00

Use forge IDs for hook tokens (#4897)

Co-authored-by: Robert Kaussow <xoxys@rknet.org>
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
This commit is contained in:
qwerty287
2025-02-25 17:07:37 +02:00
committed by GitHub
parent f47165ff9f
commit 64578bff46
2 changed files with 19 additions and 5 deletions

View File

@@ -248,7 +248,18 @@ func PostHook(c *gin.Context) {
}
func getRepoFromToken(store store.Store, t *token.Token) (*model.Repo, error) {
// try to get the repo by the repo-id
if t.Get("repo-forge-remote-id") != "" {
// TODO: use both the forge ID and repo forge remote ID
/*forgeID, err := strconv.ParseInt(t.Get("forge-id"), 10, 64)
if err != nil {
return nil, err
}*/
return store.GetRepoForgeID(model.ForgeRemoteID(t.Get("repo-forge-remote-id")))
}
// get the repo by the repo-id
// TODO: remove in next major
repoID, err := strconv.ParseInt(t.Get("repo-id"), 10, 64)
if err != nil {
return nil, err