Skip to content

Conversation

ChristopherHX
Copy link
Contributor

@ChristopherHX ChristopherHX commented Oct 10, 2025

  • share more logic

Closes #35622

* share more logic
@ChristopherHX ChristopherHX added type/bug type/refactoring Existing code has been cleaned up. There should be no new functionality. topic/gitea-actions related to the actions of Gitea labels Oct 10, 2025
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 10, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Oct 10, 2025
@ChristopherHX ChristopherHX marked this pull request as ready for review October 11, 2025 10:51
@ChristopherHX
Copy link
Contributor Author

This shows how, worse the duplication is at the moment. Preparation for further refactoring.


Maybe

  • merge the new PrepareRun with InsertRun
  • change the name of PrepareRun

At least the surface of doing code path specific inconsistent changes decreases and more tests cover the shared code than the specific code ever did.

}

// FIXME PERF skip this for schedule, dispatch etc.
CreateCommitStatus(ctx, allJobs...)
Copy link
Contributor Author

@ChristopherHX ChristopherHX Oct 11, 2025

Choose a reason for hiding this comment

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

old code conditionally didn't call this, nested function does the check

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we fix this FIXME in this PR? Or leave it to the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed this now, by extracting the event check of createCommitStatus into a reusable function that takes the run without traversing over all jobs.

@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 Oct 11, 2025
@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 Oct 11, 2025
@github-actions github-actions bot added the modifies/api This PR adds API routes or modifies them label Oct 12, 2025
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 12, 2025

Made some new changes, now we require callers to pass "run" when calling CreateCommitStatusForRunJobs, then it is CreateCommitStatusForRunJobs's responsibility to decide whether to create the status (for example: no status for cron/scheduled jobs). And we only need to retrieve event name and commit id once for a run.

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. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code topic/gitea-actions related to the actions of Gitea type/bug type/refactoring Existing code has been cleaned up. There should be no new functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent context availability in run-name

5 participants