mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-09 00:30:28 +00:00
fix: composite action log result reported as step result (#801)
Act logs an array of stepID to signal that this is an partial step result within an composite actions, this is the case for years and act_runner never handled it correctly. Ref: <https://gitea.com/gitea/act/src/commit/43e6958fa32eb3eadf7988c4a8f4da857650738a/pkg/runner/logger.go#L142> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/801 Reviewed-by: silverwind <[email protected]>
This commit is contained in:
1 parent
ae6e5dfcf7
commit
f0f9f0c8ab
2 files changed
+29
-2
No files matched your search
@@ -96,6 +96,18 @@ func appendIfNotNil[T any](s []*T, v *T) []*T {
|
||||
return s
|
||||
}
|
||||
|
||||
// isJobStepEntry is used to not report composite step results incorrectly as step result
|
||||
// returns true if the logentry is on job level
|
||||
// returns false for composite action step messages
|
||||
func isJobStepEntry(entry *log.Entry) bool {
|
||||
if v, ok := entry.Data["stepID"]; ok {
|
||||
if v, ok := v.([]string); ok && len(v) > 1 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (r *Reporter) Fire(entry *log.Entry) error {
|
||||
r.stateMu.Lock()
|
||||
defer r.stateMu.Unlock()
|
||||
@@ -166,7 +178,7 @@ func (r *Reporter) Fire(entry *log.Entry) error {
|
||||
} else if !r.duringSteps() {
|
||||
r.logRows = appendIfNotNil(r.logRows, r.parseLogRow(entry))
|
||||
}
|
||||
if v, ok := entry.Data["stepResult"]; ok {
|
||||
if v, ok := entry.Data["stepResult"]; ok && isJobStepEntry(entry) {
|
||||
if stepResult, ok := r.parseResult(v); ok {
|
||||
if step.LogLength == 0 {
|
||||
step.LogIndex = int64(r.logOffset + len(r.logRows))
|
||||
|
||||
Reference in new issue
Block a user