jojo/models/actions
limiting-factor 51866ad6b8 [v15.0/forgejo] fix: in actions_service cancelJobsForRun is bugous use killRun instead (#12492)
The conflict resolution is explained in the "Conflict" section of the commit message. I used `cherry-pick -x`. Here is the conflict for information (simple one).

```diff
unmerged   services/actions/schedule_tasks.go
@@@ -22,8 -22,7 +22,12 @@@ import

  	"code.forgejo.org/forgejo/runner/v12/act/jobparser"
  	act_model "code.forgejo.org/forgejo/runner/v12/act/model"
++<<<<<<< HEAD
 +	"github.com/robfig/cron/v3"
 +	"xorm.io/builder"
++=======
+ 	"github.com/gdgvda/cron"
++>>>>>>> b6af380324 (fix: in actions_service cancelJobsForRun is bugous use killRun instead)
  )

  // StartScheduleTasks start the task
```

---

**Backport:** https://codeberg.org/forgejo/forgejo/pulls/12366

The cancelJobsForRun function is redundant with the killRun function
and has bugs:

- It does not use a transaction and may fail in a non-recoverable way
- It does not update the commit status of the run
- It does not set NeedRemoval to false if needed

Remove the cancelJobsForRun function and use killRun instead (fixing
forgejo/forgejo#12386). Both calls are covered by existing tests:

- TestCancelPreviousJobs
- TestCancelPreviousWithConcurrencyGroup

A new integration test TestActionsPullRequestTrustPushCancel is added
to verify that the NeedApproval field is set to false whenever a run
is cancelled (fixing forgejo/forgejo#12350).

Closes forgejo/forgejo#12350
Closes forgejo/forgejo#12386

(cherry picked from commit b6af380324)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12492
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-05-09 21:00:52 +02:00
..
TestActionTask_GetTasksByRunnerRequestKey fix: allow Actions runner to recover tasks lost during fetching from intermittent errors (#11401) 2026-02-22 23:24:38 +01:00
TestRunner_FindRunnerOptionsToConds refactor: replace WithAvailable with WithVisible when fetching runners (#11657) 2026-03-13 01:43:32 +01:00
TestRunner_GetVisibleRunnerByID refactor: replace WithAvailable with WithVisible when fetching runners (#11657) 2026-03-13 01:43:32 +01:00
artifact.go feat: artifacts can be downloaded using their id instead of their name (#8957) 2025-08-25 15:51:26 +02:00
forgejo.go feat: implement ephemeral runners (#9962) 2026-02-16 18:56:56 +01:00
forgejo_test.go feat: implement ephemeral runners (#9962) 2026-02-16 18:56:56 +01:00
main_test.go feat: ability to view previous logs for Actions runs that have been retried (#9017) 2025-09-04 22:46:22 +02:00
pre_execution_errors.go [v15.0/forgejo] fix: prevent jobs with unknown needs from running (#12077) 2026-04-10 18:22:49 +02:00
pre_execution_errors_test.go feat: support reusable workflow expansion when with or strategy.matrix contains ${{ needs... }} (#10647) 2025-12-31 19:04:35 +01:00
run.go [v15.0/forgejo] fix: in actions_service cancelJobsForRun is bugous use killRun instead (#12492) 2026-05-09 21:00:52 +02:00
run_job.go [v15.0/forgejo] fix: prevent jobs with unknown needs from running (#12077) 2026-04-10 18:22:49 +02:00
run_job_list.go [v15.0/forgejo] fix: prevent jobs with unknown needs from running (#12077) 2026-04-10 18:22:49 +02:00
run_job_list_test.go [v15.0/forgejo] fix: prevent jobs with unknown needs from running (#12077) 2026-04-10 18:22:49 +02:00
run_job_status_test.go Improve Actions status aggregations (#32860) 2024-12-22 08:46:38 +01:00
run_job_test.go [v15.0/forgejo] fix: prevent jobs with unknown needs from running (#12077) 2026-04-10 18:22:49 +02:00
run_list.go feat(ui): support additional job status selection in dropdown menu on Actions tab (#11156) 2026-02-11 03:22:53 +01:00
run_list_test.go feat(ui): support additional job status selection in dropdown menu on Actions tab (#11156) 2026-02-11 03:22:53 +01:00
run_test.go [v15.0/forgejo] fix: allow viewing Actions run triggered by deleted user (#12272) 2026-04-26 16:00:57 +02:00
runner.go feat: make it possible to search runners by UUID (#11671) 2026-03-14 04:12:00 +01:00
runner_list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
runner_test.go feat: make it possible to search runners by UUID (#11671) 2026-03-14 04:12:00 +01:00
runner_token.go refactor: replace ActionRunnerToken.OwnerID & RepoID with optional.Option[int64] (#11601) 2026-03-10 03:19:16 +01:00
runner_token_test.go refactor: replace ActionRunnerToken.OwnerID & RepoID with optional.Option[int64] (#11601) 2026-03-10 03:19:16 +01:00
schedule.go [v15.0/forgejo] feat: support timezone in scheduled workflows (#11986) 2026-04-04 19:16:35 +02:00
schedule_spec.go [v15.0/forgejo] feat: support timezone in scheduled workflows (#11986) 2026-04-04 19:16:35 +02:00
schedule_spec_list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
schedule_spec_test.go [v15.0/forgejo] feat: support timezone in scheduled workflows (#11986) 2026-04-04 19:16:35 +02:00
schedule_test.go [v15.0/forgejo] feat: support timezone in scheduled workflows (#11986) 2026-04-04 19:16:35 +02:00
status.go [v15.0/forgejo]: chore: add modernizer linter (#11949) 2026-04-02 16:54:46 +02:00
task.go [v15.0/forgejo] fix: superfluous increment of ActionTask attempt breaks job view (#11964) 2026-04-03 18:29:31 +02:00
task_list.go feat: add more filters to actions run and tasks api (#11584) 2026-03-10 01:20:00 +01:00
task_output.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
task_step.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
task_test.go fix: allow Actions runner to recover tasks lost during fetching from intermittent errors (#11401) 2026-02-22 23:24:38 +01:00
tasks_version.go chore: fix typos throughout the codebase (#10753) 2026-01-26 22:57:33 +01:00
user.go feat: add ActionUser model & fields to ActionRun 2025-11-06 11:07:38 +01:00
user_test.go feat: add ActionUser model & fields to ActionRun 2025-11-06 11:07:38 +01:00
utils.go chore: unify the usage of CryptoRandomString (#10110) 2025-11-15 13:24:53 +01:00
utils_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
variable.go fix: include variable values in /repos/.../actions/variables API response (#10036) 2025-11-10 23:07:32 +01:00