Replace index with id in actions routes#36842
Conversation
d8bab42 to
7106d44
Compare
There was a problem hiding this comment.
Pull request overview
Migrates the repository web UI Actions run/job routes from index-based identifiers (runIndex/jobIndex) to stable database IDs (runID/jobID), aligning the web routes with the API and enabling more reliable addressing (especially with reusable workflows/child jobs).
Changes:
- Update frontend components/templates to pass and consume
runId/jobId, and generate/actions/runs/{runID}/jobs/{jobID}links. - Update backend web handlers and helpers to resolve runs/jobs by repo+ID (and run+job ID) and adjust log/rerun/cancel/approve/delete endpoints accordingly.
- Update and extend integration/unit tests to reflect ID-based URLs and add coverage for cross-repo run/job access protections.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web_src/js/features/repo-actions.ts | Pass runId/jobId props into the Actions view Vue app. |
| web_src/js/components/WorkflowGraph.vue | Switch “current job” selection and job links from index to job ID. |
| web_src/js/components/RepoActionView.vue | Update API calls and UI links (jobs, logs, rerun) to use IDs. |
| templates/repo/actions/view_component.tmpl | Replace data-run-index/data-job-index with data-run-id/data-job-id. |
| templates/repo/actions/view.tmpl | Pass RunID/JobID into the view component instead of indexes. |
| templates/devtest/repo-action-view.tmpl | Update devtest template wiring to use RunID/JobID. |
| routers/web/repo/actions/view.go | Rework run/job resolution and all related endpoints (view/post/logs/rerun/cancel/approve/delete) to use IDs. |
| routers/web/devtest/mock_actions.go | Update devtest mock handler data keys to RunID/JobID. |
| routers/common/actions.go | Replace “download logs by job index” helper with “by job ID” helper. |
| routers/api/v1/repo/actions_run.go | Scope job-log download lookup by repo+job ID. |
| routers/api/v1/repo/action.go | Return Actions dispatch HTMLURL using run ID instead of run index. |
| services/convert/convert.go | Update webhook/API conversion to emit job HTMLURL using job ID. |
| services/actions/rerun.go | Ensure run attributes are loaded before rerun logic continues (needed for downstream usage). |
| services/actions/commit_status.go | Update commit-status target URLs and parsing/lookup paths to use IDs. |
| models/actions/run.go | Change ActionRun HTMLURL()/Link() to use run database ID. |
| models/actions/run_job.go | Replace GetRunJobByID with repo/run-scoped getters; adjust UpdateRunJob reload path accordingly. |
| models/actions/task.go | Ensure job loading and run-job updates are repo-scoped; include RepoID when updating jobs from tasks. |
| models/git/commit_status_test.go | Update Actions target URL test fixture to the new /runs/{id}/jobs/{id}-style pattern. |
| tests/integration/repo_webhook_test.go | Update expected webhook HTMLURL and UI endpoints to use run/job IDs. |
| tests/integration/api_actions_run_test.go | Update job lookup helpers in API rerun tests to be run-scoped. |
| tests/integration/actions_rerun_test.go | Update rerun endpoints to use run/job IDs. |
| tests/integration/actions_log_test.go | Update log download paths to use run/job IDs derived from tasks. |
| tests/integration/actions_delete_run_test.go | Resolve run ID from run number and update all URLs to use run/job IDs. |
| tests/integration/actions_concurrency_test.go | Update approve/rerun/cancel/job rerun URLs to use IDs; adjust assertions accordingly. |
| tests/integration/actions_route_test.go | New integration test validating repo scoping and 404 behavior for mismatched run/job IDs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Zettat123 <zettat123@gmail.com>
|
Since the legacy gitea/services/actions/commit_status.go Lines 190 to 197 in eb020a9 I’ve added a migration to convert all legacy TargetURLs into id-based URLs. This migration also addresses the issue in #36842 (comment) |
|
Review by Claude on behalf of @silverwind
|
This PR migrates the web Actions run/job routes from index-based
runIndexorjobIndexto database IDs.Improvements of this change:
jobIndexdepended on list order, making it hard to locate a specific job. UsingjobIDprovides stable addressing.