Skip to content

fix(actions): show "Complete job" logs when the last step is skipped - #38939

Open
bircni wants to merge 3 commits into
go-gitea:mainfrom
bircni:fix-complete-job-logs-skipped-last-step
Open

fix(actions): show "Complete job" logs when the last step is skipped#38939
bircni wants to merge 3 commits into
go-gitea:mainfrom
bircni:fix-complete-job-logs-skipped-last-step

Conversation

@bircni

@bircni bircni commented Aug 15, 2026

Copy link
Copy Markdown
Member

FullSteps only gave the synthetic "Complete job" step the remaining log range when the last step that had run was also the final step of the job. A skipped step does not count as having run, so any job ending in a skipped step left the post step with an empty range: its logs were stored but never rendered, and the duration showed as 0s.

Reproducible with any job whose last step is skipped, which is common for failure notifications:

steps:
  - run: echo hello
  - run: echo never
    if: failure()

The gate now checks whether the final step is done, which preserves the behaviour from #29926 of showing the post step as waiting while steps are still pending.
--> Regression from #29926

The synthetic post step only claimed the remaining log range when the
last step that had run was the final step in the list. A skipped step is
not counted as having run, so a job ending in a skipped step left the
post step with an empty range, hiding its logs and reporting 0s.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 15, 2026
@github-actions github-actions Bot added topic/gitea-actions related to the actions of Gitea type/bug labels Aug 15, 2026
@bircni
bircni requested review from Zettat123 and wolfogre August 15, 2026 16:51
@bircni bircni added the backport/v1.27 This PR should be backported to Gitea 1.27 label Aug 15, 2026
@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 Aug 15, 2026
// If the lastHasRunStep is the last step, or it has failed, postStep has started.
if lastHasRunStep.Status.IsFailure() || lastHasRunStep == task.Steps[len(task.Steps)-1] {
// If no step is left to run, or the lastHasRunStep has failed, postStep has started.
if lastHasRunStep.Status.IsFailure() || task.Steps[len(task.Steps)-1].Status.IsDone() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Update the comments above?

	// For example,
	// 1. preStep(Success) -> step1(Success) -> step2(Running) -> step3(Waiting) -> postStep(Waiting): lastHasRunStep is step1.
	// 2. preStep(Success) -> step1(Success) -> step2(Success) -> step3(Success) -> postStep(Success): lastHasRunStep is step3.
	// 3. preStep(Success) -> step1(Success) -> step2(Failure) -> step3 -> postStep(Waiting): lastHasRunStep is step2.
	// So its Stopped is the Started of postStep when there are no more steps to run.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unresolved.

What's this? Just duplicate the last line?

image

@bircni
bircni requested a review from a team August 17, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/v1.27 This PR should be backported to Gitea 1.27 lgtm/need 1 This PR needs approval from one additional maintainer to be merged. topic/gitea-actions related to the actions of Gitea type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants