Skip to content

Conversation

ChristopherHX
Copy link
Contributor

Use a helper method around the jobparser for parsing a single job structure from an ActionRunJob

@ChristopherHX ChristopherHX added type/refactoring Existing code has been cleaned up. There should be no new functionality. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. 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
@wxiaoguang
Copy link
Contributor

Made some changes in 0c14f30 .

Since parsedWorkflows[0].Job() can return nil, I think we should treat such case as error

if wfJobs, _ := jobparser.Parse(actionRunJob.WorkflowPayload); len(wfJobs) == 1 {
_, wfJob := wfJobs[0].Job()
hasIf = len(wfJob.If.Value) > 0
// FIXME evaluate this on the server side
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate more details? For example, what wrong would happen and how to evaluate on server side?

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 plan to create a more detailed refactoring proposal issue collection soon. 1

how to evaluate on server side?

This is similar to what concurrency for jobs is currently doing, Gitea references gitea/act that has all code for doing this kind of thing.

what wrong would happen

  • a to be skipped job lands in the concurrency group and prevents a non skipped job of the same group from running
  • a to be skipped job waits for a runner to become online to update the job status to skipped
    • gitea can just update the status to skipped without additional db writes, by skipping the Status Waiting.
  • all contexts should be available to the server
    • needs
    • vars
    • github/gitea
    • (env) extension

More refactoring is needed for those examples:

  • strategy (matrix) is evaluated even if the condition is false (extension matrix in if then strategy must evaluate earlier)
    • e.g. the expression in strategy depends on outputs not being set or you want to skip all
  • Reusable Workflows without runs-on should run on server as well and they should be able to deliver jobs to multiple different runners
  • jobif: ${{ cancelled() }} should be able to ignore cancel requests to be delivered to the runner
    • currently gitea force cancels every job, without a grace period of 5min

Footnotes

  1. The problems I describe are platform differences between GitHub and Gitea Actions that I would like to remove, already existing enhancements towards Actions should be unaffected

@ChristopherHX
Copy link
Contributor Author

Since parsedWorkflows[0].Job() can return nil, I think we should treat such case as error

Sounds good, would improve logging

@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 skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. topic/gitea-actions related to the actions of Gitea 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.

3 participants