Skip to content

fix(actions): prevent panic when workflow contains null jobs (#37570)#37576

Merged
silverwind merged 1 commit into
go-gitea:release/v1.26from
GiteaBot:backport-37570-v1.26
May 7, 2026
Merged

fix(actions): prevent panic when workflow contains null jobs (#37570)#37576
silverwind merged 1 commit into
go-gitea:release/v1.26from
GiteaBot:backport-37570-v1.26

Conversation

@GiteaBot
Copy link
Copy Markdown
Collaborator

@GiteaBot GiteaBot commented May 7, 2026

Backport #37570 by @Exgene

The issue

Closes #37568. Basically due to empty fields being present in the actions file, the jobs would be produced as nil inside jobparser.go . Because of this when we call Parse on the jobparser module.

Needs:   job.Needs(),

would propagate the nil job down the chain.

The fix

For now i decide to fix it by guarding with an if job == nil check.

…a#37570)

## The issue

Closes go-gitea#37568. Basically due to empty fields being present in the
actions file, the jobs would be produced as `nil` inside `jobparser.go`
. Because of this when we call `Parse` on the `jobparser` module.

```go
Needs:   job.Needs(),
```

would propagate the `nil` job down the chain. 

## The fix

For now i decide to fix it by guarding with an `if job == nil` check.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
@GiteaBot GiteaBot requested review from Zettat123 and lunny May 7, 2026 02:03
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 7, 2026
@GiteaBot GiteaBot added this to the 1.26.2 milestone May 7, 2026
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 7, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 7, 2026
@silverwind silverwind enabled auto-merge (squash) May 7, 2026 02:20
@silverwind silverwind merged commit b586d80 into go-gitea:release/v1.26 May 7, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants