forgejo/models/actions
Mathieu Fenniak eb21dd17b8 fix: loading action logs on a task that isn't fetched yet, fails when the job is fetched (#9293)
Discovered a regression caused by #9017.

Steps to reproduce:
- Disable the forgejo-runner that will pick up a workflow
- Trigger any workflow to run
- Through the Actions list, click on the new workflow that is pending a runner to fetch it
- You'll be redirected to /user/repo/actions/runs/73/jobs/0/attempt/0  (attempt = 0)
  - The UI will appear normal with the job "Waiting"...
- Startup the forgejo-runner to pick up the workflow
- The UI will begin to have errors:
    - JavaScript promise rejection: JSON.parse: unexpected keyword at line 1 column 1 of the JSON data. Open browser console to see more details. (5)

The cause is that the redirect to `/attempt/0` occurs for a job that hasn't been started, but once the job is started attempt 0 is not a valid attempt and errors will occur when polling for data.  This fix corrects the problem by redirecting to the attempt that will be present (attempt 1) when the job is fetched.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9293
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-09-14 14:30:02 +02: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 chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
forgejo_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00: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
run.go Update module code.forgejo.org/forgejo/runner/v9 to v11 (forgejo) (#9218) 2025-09-10 22:02:55 +02:00
run_job.go fix: loading action logs on a task that isn't fetched yet, fails when the job is fetched (#9293) 2025-09-14 14:30:02 +02:00
run_job_list.go feat: make action runs available in api (#7699) 2025-06-02 22:05:12 +02:00
run_job_status_test.go Improve Actions status aggregations (#32860) 2024-12-22 08:46:38 +01:00
run_job_test.go feat: ability to view previous logs for Actions runs that have been retried (#9017) 2025-09-04 22:46:22 +02:00
run_list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
run_test.go fix: disable Forgejo Actions email notifications on recovery (#8374) 2025-07-02 19:23:07 +02:00
runner.go feat: auto cleanup of offline runners (#7803) 2025-06-08 00:13:37 +02:00
runner_list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
runner_test.go feat: auto cleanup of offline runners (#7803) 2025-06-08 00:13:37 +02:00
runner_token.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
runner_token_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
schedule.go feat: move StopTask, CancelPreviousJobs and CleanRepoScheduleTasks to services/actions 2025-04-10 08:38:27 +02:00
schedule_spec.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
schedule_spec_list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
schedule_spec_test.go Use UTC as default timezone when schedule Actions cron tasks (#31742) 2024-08-04 18:24:10 +02:00
status.go feat: make action runs available in api (#7699) 2025-06-02 22:05:12 +02:00
task.go Update module code.forgejo.org/forgejo/runner/v9 to v11 (forgejo) (#9218) 2025-09-10 22:02:55 +02:00
task_list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00: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 feat: ability to view previous logs for Actions runs that have been retried (#9017) 2025-09-04 22:46:22 +02:00
tasks_version.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
utils.go chore(sec): unify usage of crypto/rand.Read (#7453) 2025-04-04 03:31:37 +00:00
utils_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
variable.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00