aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/actions
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2023-03-04 15:12:37 +0800
committerGitHub <noreply@github.com>2023-03-04 02:12:37 -0500
commit47b912cd526207f831bff759b29a734049d1c8f2 (patch)
treeeb59e9c8ea504339d784b116375ee7dc0e0bffea /routers/api/actions
parentca84a61761dc78fea7afe5a692deac7db5368dff (diff)
downloadgitea-47b912cd526207f831bff759b29a734049d1c8f2.tar.gz
gitea-47b912cd526207f831bff759b29a734049d1c8f2.zip
Avoid panic caused by broken payload when creating commit status (#23216)
When creating commit status for Actons jobs, a payload with nil `HeadCommit` will cause panic. Reported at: https://gitea.com/gitea/act_runner/issues/28#issuecomment-732166 Although the `HeadCommit` probably can not be nil after #23215, `CreateCommitStatus` should protect itself, to avoid being broken in the future. In addition, it's enough to print error log instead of returning err when `CreateCommitStatus` failed. --------- Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'routers/api/actions')
-rw-r--r--routers/api/actions/runner/runner.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/api/actions/runner/runner.go b/routers/api/actions/runner/runner.go
index 3299eaf1e4..07657c9120 100644
--- a/routers/api/actions/runner/runner.go
+++ b/routers/api/actions/runner/runner.go
@@ -150,7 +150,7 @@ func (s *Service) UpdateTask(
}
if err := actions_service.CreateCommitStatus(ctx, task.Job); err != nil {
- log.Error("Update commit status failed: %v", err)
+ log.Error("Update commit status for job %v failed: %v", task.Job.ID, err)
// go on
}