0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-14 07:35:44 +01:00
gitea/services/actions
Zettat123 31a0c4dfb4
Improve the handling of jobs.<job_id>.if (#31070)
Fix #25897
Fix #30322

#29464 cannot handle some complex `if` conditions correctly because it
only checks `always()` literally. In fact, it's not easy to evaluate the
`if` condition on the Gitea side because evaluating it requires a series
of contexts. But act_runner is able to evaluate the `if` condition
before running the job (for more information, see
[`gitea/act`](517d11c671/pkg/runner/run_context.go (L739-L753)))
. So we can use act_runner to check the `if` condition.

In this PR, how to handle a blocked job depends on its `needs` and `if`:
- If not all jobs in `needs` completed successfully and the job's `if`
is empty, set the job status to `StatusSkipped`
- In other cases, the job status will be set to `StatusWaiting`, and
then act_runner will check the `if` condition and run the job if the
condition is met
2024-05-27 14:15:34 +08:00
..
auth_test.go
auth.go
cleanup.go
clear_tasks.go
commit_status.go
init.go
interface.go
job_emitter_test.go
job_emitter.go
notifier_helper.go
notifier.go
rerun_test.go
rerun.go
schedule_tasks.go
variables.go