fix(github): scope PR CI automation switches per linked PR (#2512)

Co-authored-by: ayattara <alassane.yattara@savoirfairelinux.com>
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
This commit is contained in:
Alassane
2026-08-12 13:36:11 -04:00
committed by GitHub
parent 76ccc667ce
commit 7855a4e087
41 changed files with 2803 additions and 790 deletions
@@ -396,6 +396,10 @@ func (c *Controller) writeTaskCIOptionsError(ctx *gin.Context, err error, operat
ctx.JSON(http.StatusNotFound, gin.H{"error": "task not found"})
return
}
if errors.Is(err, ErrTaskPRNotLinked) {
ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
if writeGitHubOperationalAuthError(ctx, err) {
return
}
@@ -417,6 +421,18 @@ func parseTaskCIOptionsPatch(ctx *gin.Context) (TaskCIOptionsPatch, error) {
var patch TaskCIOptionsPatch
for key, value := range raw {
switch key {
case "repository_id":
var repositoryID string
if err := json.Unmarshal(value, &repositoryID); err != nil {
return TaskCIOptionsPatch{}, err
}
patch.RepositoryID = &repositoryID
case "pr_number":
var prNumber int
if err := json.Unmarshal(value, &prNumber); err != nil {
return TaskCIOptionsPatch{}, err
}
patch.PRNumber = &prNumber
case "auto_fix_enabled":
var enabled bool
if err := json.Unmarshal(value, &enabled); err != nil {