forgejo/services/actions
Zettat123 ec05ab1e3c
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

(cherry picked from commit 31a0c4dfb4156a7b4d856cceae1e61c7fc1a4a1b)
2024-06-02 09:08:07 +02:00
..
auth.go
auth_test.go Add interface{} to any replacement to make fmt, exclude *.pb.go (#30461) 2024-04-15 20:01:36 +02:00
cleanup.go
clear_tasks.go
commit_status.go fix(actions): call automerge service on successful commit state 2024-04-15 16:17:45 +02:00
init.go
interface.go feat(api): enhance Actions Secrets Management API for repository (#30656) 2024-04-28 15:39:01 +02:00
job_emitter.go Improve the handling of jobs.<job_id>.if (#31070) 2024-06-02 09:08:07 +02:00
job_emitter_test.go Improve the handling of jobs.<job_id>.if (#31070) 2024-06-02 09:08:07 +02:00
main_test.go
notifier.go fix: hook post-receive for sha256 repos 2024-05-15 16:43:16 +02:00
notifier_helper.go Enable more revive linter rules (#30608) 2024-04-28 15:39:00 +02:00
notifier_helper_test.go
rerun.go
rerun_test.go
schedule_tasks.go Interpolate runs-on with variables when scheduling tasks (#30640) 2024-04-28 15:39:00 +02:00
variables.go