Skip to content

Feature: Add button to re-run failed jobs in Actions#36924

Merged
wxiaoguang merged 10 commits into
go-gitea:mainfrom
bircni:feature/rerun-failed-jobs
Mar 21, 2026
Merged

Feature: Add button to re-run failed jobs in Actions#36924
wxiaoguang merged 10 commits into
go-gitea:mainfrom
bircni:feature/rerun-failed-jobs

Conversation

@bircni
Copy link
Copy Markdown
Member

@bircni bircni commented Mar 18, 2026

Fixes #35997

Summary

Adds a "Re-run failed jobs" button to the Actions run view, matching the behaviour available on GitHub. When clicked, only failed jobs and their downstream dependents are rerun — passing jobs are left untouched.

  • Adds RerunFailedWorkflowRunJobs service function and GetFailedRerunJobs helper
  • Adds web route POST /{run}/rerun-failed and handler
  • Adds API endpoint POST /repos/{owner}/{repo}/actions/runs/{run}/rerun-failed-jobs
  • The button is only shown when the run is done and has at least one failed job; "Re-run all jobs" is shown alongside it

Screenshots

grafik

Open Questions

  • UI: dropdown button? Currently "Re-run failed jobs" and "Re-run all jobs" are two separate buttons shown side by side. Should they be combined into a single split/dropdown button (primary action = re-run failed, secondary = re-run all) to reduce visual clutter? --> yes
grafik

I tried to do my best to implement this and used Claude Code as assistance

Adds a "Re-run failed jobs" button to the Actions run view that reruns
only failed jobs and their downstream dependents, matching GitHub's
behaviour described in issue go-gitea#35997.

- Add `RerunFailedWorkflowRunJobs` service function
- Add `GetFailedRerunJobs` helper with full test coverage
- Add web route `POST /{run}/rerun-failed` and handler `RerunFailed`
- Add API route `POST /runs/{run}/rerun-failed-jobs`
- Show button only when the run is done and has at least one failed job
- Extract `checkRunRerunAllowed` guard shared by both web handlers
- Merge `validateRunForRerun` into `prepareRunRerun` (one function)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 18, 2026
Comment thread web_src/js/components/RepoActionView.vue Outdated
Comment thread routers/api/v1/api.go
@bircni bircni marked this pull request as ready for review March 18, 2026 21:04
@bircni
Copy link
Copy Markdown
Member Author

bircni commented Mar 18, 2026

Added a drop down button --> see description

@bircni
Copy link
Copy Markdown
Member Author

bircni commented Mar 20, 2026

@wxiaoguang is anything missing?

@wxiaoguang
Copy link
Copy Markdown
Contributor

I can review for the code-level.

For feature&function level, it's better to ask Actions users to review (I don't use Actions)

@bircni
Copy link
Copy Markdown
Member Author

bircni commented Mar 20, 2026

I can review for the code-level.

For feature&function level, it's better to ask Actions users to review (I don't use Actions)

Would be great!!
Who is active for actions?

@bircni
Copy link
Copy Markdown
Member Author

bircni commented Mar 20, 2026

Just saw @lunny are you interested?

Comment thread routers/api/v1/repo/action.go Outdated
Comment thread routers/web/repo/actions/view.go
Comment thread services/actions/rerun.go Outdated
Comment thread web_src/js/components/RepoActionView.vue Outdated
@lunny
Copy link
Copy Markdown
Member

lunny commented Mar 20, 2026

Just saw @lunny are you interested?

I will review it later. It's better if @Zettat123 could also review it.

Comment thread services/actions/rerun.go
@bircni bircni requested a review from Zettat123 March 21, 2026 09:40
@wxiaoguang
Copy link
Copy Markdown
Contributor

Is it possible to merge "RerunWorkflowRunJobs" functions?

It seems that it only needs one general function: RerunWorkflowRunJobs(ctx, allJobs, jobsToRerun)

  • Rerun one job: RerunWorkflowRunJobs(ctx, allJobs, jobsToRerun, []*Job{singleJob})
  • Rerun all jobs: RerunWorkflowRunJobs(ctx, allJobs, allJobs)
  • Rerun failed jobs: RerunWorkflowRunJobs(ctx, allJobs, getFailedJobs(allJobs))

@bircni
Copy link
Copy Markdown
Member Author

bircni commented Mar 21, 2026

Is it possible to merge "RerunWorkflowRunJobs" functions?

It seems that it only needs one general function: RerunWorkflowRunJobs(ctx, allJobs, jobsToRerun)

  • Rerun one job: RerunWorkflowRunJobs(ctx, allJobs, jobsToRerun, []*Job{singleJob})
  • Rerun all jobs: RerunWorkflowRunJobs(ctx, allJobs, allJobs)
  • Rerun failed jobs: RerunWorkflowRunJobs(ctx, allJobs, getFailedJobs(allJobs))

should be - give me some minutes to check

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 21, 2026
@lunny lunny added this to the 1.26.0 milestone Mar 21, 2026
@lunny lunny requested a review from Copilot March 21, 2026 18:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “Re-run failed jobs” support for Actions workflow runs, including UI, web route, and API endpoint, so users can rerun only failed jobs plus downstream dependents (leaving successful jobs untouched).

Changes:

  • Add failed-job rerun selection logic (GetFailedRerunJobs) and refactor rerun service to accept an explicit job list.
  • Add web UI/handler for POST rerun-failed and expose canRerunFailed in the run view model.
  • Add API endpoint + swagger documentation for rerunning failed jobs, and add new locale string.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
web_src/js/features/repo-actions.ts Passes new rerun_failed locale string into the Actions run Vue app.
web_src/js/components/RepoActionView.vue Adds split/dropdown UI for “Re-run failed jobs” vs “Re-run all jobs”.
templates/repo/actions/view_component.tmpl Provides data-locale-rerun-failed for the frontend.
options/locale/locale_en-US.json Adds English string for “Re-run failed jobs”.
services/actions/rerun.go Implements GetFailedRerunJobs, refactors rerun logic into prepareRunRerun, updates job blocking rules.
services/actions/rerun_test.go Adds unit tests for failed rerun job selection and validation behavior.
routers/web/repo/actions/view.go Exposes CanRerunFailed, adds /rerun-failed handler, refactors rerun-allowed checks.
routers/web/web.go Registers POST route /rerun-failed for run pages.
routers/web/devtest/mock_actions.go Mocks CanRerunFailed in dev test data.
routers/api/v1/api.go Registers API route /rerun-failed-jobs.
routers/api/v1/repo/action.go Adds API handler RerunFailedWorkflowRun and updates rerun call sites to new service signature.
templates/swagger/v1_json.tmpl Adds swagger path entry for /rerun-failed-jobs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web_src/js/components/RepoActionView.vue
Comment thread web_src/js/components/RepoActionView.vue
Comment thread routers/api/v1/repo/action.go
Comment thread templates/swagger/v1_json.tmpl
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 21, 2026
Comment thread routers/web/repo/actions/view.go
@wxiaoguang wxiaoguang marked this pull request as draft March 21, 2026 20:09
@wxiaoguang wxiaoguang requested a review from Zettat123 March 21, 2026 20:10
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Mar 21, 2026
@bircni
Copy link
Copy Markdown
Member Author

bircni commented Mar 21, 2026

@wxiaoguang @Zettat123 can we convert it to "ready for review" again?
All resolved?

@wxiaoguang wxiaoguang marked this pull request as ready for review March 21, 2026 20:57
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 21, 2026
@wxiaoguang wxiaoguang enabled auto-merge (squash) March 21, 2026 20:58
@wxiaoguang wxiaoguang merged commit b22123e into go-gitea:main Mar 21, 2026
26 checks passed
@bircni bircni deleted the feature/rerun-failed-jobs branch March 21, 2026 21:28
@bircni bircni mentioned this pull request Mar 22, 2026
lunny pushed a commit that referenced this pull request Mar 22, 2026
I'd like to apply as a maintainer.

Thanks to @TheFox0x7 for the suggestion.

Merged PRs:
- #36441
- #36571
- #36603
- #36768
- #36776
- #36783
- #36876
- #36883
- #36924

Ongoing work:
- #36514
- #36752
- #36912
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 23, 2026
* giteaofficial/main:
  Add user badges (go-gitea#36752)
  Apply as maintainer (go-gitea#36947)
  Refactor storage content-type handling of ServeDirectURL (go-gitea#36804)
  Add summary to action runs view (go-gitea#36883)
  feat: Add configurable permissions for Actions automatic tokens (go-gitea#36173)
  Feature: Add button to re-run failed jobs in Actions (go-gitea#36924)
  Support dark/light theme images in markdown (go-gitea#36922)
  fix go-gitea#36463: preserve sort order of exclusive labels from template repo (go-gitea#36931)
  fix(upgrade.sh): use HTTPS for GPG key import and restore SELinux context after upgrade (go-gitea#36930)
  [skip ci] Updated translations via Crowdin
  Make container registry support Apple Container (basic auth) (go-gitea#36920)
  Fix various trivial problems (go-gitea#36921)
silverwind added a commit to silverwind/gitea that referenced this pull request Mar 23, 2026
* origin/main:
  Update to eslint 10 (go-gitea#36925)
  Add user badges (go-gitea#36752)
  Apply as maintainer (go-gitea#36947)
  Refactor storage content-type handling of ServeDirectURL (go-gitea#36804)
  Add summary to action runs view (go-gitea#36883)
  feat: Add configurable permissions for Actions automatic tokens (go-gitea#36173)
  Feature: Add button to re-run failed jobs in Actions (go-gitea#36924)
  Support dark/light theme images in markdown (go-gitea#36922)
  fix go-gitea#36463: preserve sort order of exclusive labels from template repo (go-gitea#36931)
  fix(upgrade.sh): use HTTPS for GPG key import and restore SELinux context after upgrade (go-gitea#36930)
  [skip ci] Updated translations via Crowdin
  Make container registry support Apple Container (basic auth) (go-gitea#36920)
  Fix various trivial problems (go-gitea#36921)
  [skip ci] Updated translations via Crowdin

# Conflicts:
#	package.json
#	pnpm-lock.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Button to restart all failed jobs

6 participants