gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Improve the handling of `jobs.<job_id>.if`

Open Zettat123 opened this issue 9 months ago • 2 comments

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) . 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

Zettat123 avatar May 24 '24 08:05 Zettat123