Fix potential log panic #82

Merged
wolfogre merged 1 commits from Zettat123/act_runner:bugfix/log-panic into main 2023-03-28 03:49:10 +00:00
Member

If a job uses a reusable workflow, the job's steps sequence will be empty.

But in log reporter, we don't check the length of r.state.Steps, which may cause panic.

if v, ok := entry.Data["stepNumber"]; ok {
	if v, ok := v.(int); ok {
		step = r.state.Steps[v]
	}
}
If a job uses a [reusable workflow](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-of-jobsjob_iduses), the job's steps sequence will be empty. But in log reporter, we don't check the length of `r.state.Steps`, which may cause panic. ``` go if v, ok := entry.Data["stepNumber"]; ok { if v, ok := v.(int); ok { step = r.state.Steps[v] } } ```
Zettat123 added 1 commit 2023-03-27 09:18:43 +00:00
All checks were successful
check and test
e1b8368d72
check Steps length
Owner

Should this be sent upstream?

Should this be sent upstream?
lunny approved these changes 2023-03-27 12:36:03 +00:00
Author
Member

Should this be sent upstream?

I don't think so. Because this bug only exists in the logger of act_runner, not in act.

> Should this be sent upstream? I don't think so. Because this bug only exists in the logger of `act_runner`, not in `act`.
wolfogre merged commit 1596e4b1fd into main 2023-03-28 03:49:10 +00:00
Sign in to join this conversation.
No description provided.