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

}

// 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.

@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
return fmt.Errorf("LoadAttributes: %w", err)
}

vars, err := actions_model.GetVariablesOfRun(ctx, run)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use this vars in InsertRun to avoid querying vars again on services/actions/run.go L112?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me to add vars as parameter to InsertRun

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Passing this as parameter to InsertRun in a5aea1b

I think that caching vars context is good to be part of an interface that is part of the passed context of the workflow run.

ChristopherHX and others added 3 commits October 11, 2025 20:49
Co-authored-by: delvh <dev.lh@web.de>
Signed-off-by: ChristopherHX <christopher.homberger@web.de>
@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
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/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