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

Choose a reason for hiding this comment

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

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

}

// FIXME PERF do we need this db round trip?
allJobs, err := db.Find[actions_model.ActionRunJob](ctx, actions_model.FindRunJobOptions{RunID: run.ID})
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 wonder why we do not use job objects that insertrun creates? This db read seems like to not bring any advantage for me.

"gopkg.in/yaml.v3"
)

// PrepareRun prepares a run before inserting it into the database
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// PrepareRun prepares a run before inserting it into the database
// PrepareRun prepares a run and inserts it into the database

Before, it read to me like the caller should call InsertRun themselves, and I was confused where the InsertRun call is…

Copy link
Contributor

Choose a reason for hiding this comment

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

PrepareRunAndInsert

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 1 This PR needs approval from one additional maintainer to be merged. 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

4 participants