Skip to content

Improve Actions status aggregations #32860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Dec 16, 2024

Make the result the same as GitHub:

  • all skipped, then result is skipped
  • any cancelled, then result cancelled

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 16, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Dec 16, 2024
@wxiaoguang wxiaoguang added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Dec 16, 2024
@TheFox0x7
Copy link
Contributor

Is Unknown a status which should change the final result? For example combination Skipped, Success, Unknown resolves currently to Skipped which isn't consistent with behavior of Skipped, Success combination.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Dec 16, 2024
@wxiaoguang
Copy link
Contributor Author

Is Unknown a status which should change the final result? For example combination Skipped, Success, Unknown resolves currently to Skipped which isn't consistent with behavior of Skipped, Success combination.

Good catch, added more cases and comments in f438b56

Copy link
Contributor

@TheFox0x7 TheFox0x7 left a comment

Choose a reason for hiding this comment

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

LGTM
I'll check how Github treats all skipped workflows later.

{[]Status{StatusFailure, StatusWaiting}, StatusFailure},
{[]Status{StatusFailure, StatusRunning}, StatusFailure},
{[]Status{StatusFailure, StatusBlocked}, StatusFailure},

// skipped with other status
{[]Status{StatusSkipped}, StatusSuccess},
// TODO: need to clarify whether a PR with "skipped" job status is considered as "mergeable" or not.
Copy link
Member

Choose a reason for hiding this comment

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

I would say yes:
As I see it, a skipped job is mainly something like execute on hardware xy, but it wasn't available. Or perhaps something like only execute once a month. Still, that doesn't prevent the PR from merging.

Copy link
Contributor

Choose a reason for hiding this comment

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

Confirmed, skips are treated as a pass:
TheFox0x7/repro#1
And cancellations as fails:
TheFox0x7/repro#2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "actions status to commit status" converting seems consistent:

func toCommitStatus(status actions_model.Status) api.CommitStatusState {
switch status {
case actions_model.StatusSuccess, actions_model.StatusSkipped:
return api.CommitStatusSuccess
case actions_model.StatusFailure, actions_model.StatusCancelled:
return api.CommitStatusFailure
case actions_model.StatusWaiting, actions_model.StatusBlocked, actions_model.StatusRunning:
return api.CommitStatusPending
default:
return api.CommitStatusError
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the comment in #32861 (with more trivial fixes)

@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 Dec 16, 2024
@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 Dec 16, 2024
@wxiaoguang
Copy link
Contributor Author

Let's merge this as-is since 1.23 is releasing soon. We can do more improvements in the future if we have new ideas and samples.

@wxiaoguang wxiaoguang merged commit 22c4599 into go-gitea:main Dec 16, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.24.0 milestone Dec 16, 2024
@wxiaoguang wxiaoguang modified the milestones: 1.24.0, 1.23.0 Dec 16, 2024
@wxiaoguang wxiaoguang deleted the fix-action-status branch December 16, 2024 13:50
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants