mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
chore(refactor): move actions_service.jobParser to actions_module.jobParser
This commit is contained in:
parent
7fccc2676b
commit
0989a2495e
5 changed files with 6 additions and 5 deletions
|
|
@ -9,7 +9,7 @@ import (
|
|||
"code.forgejo.org/forgejo/runner/v11/act/jobparser"
|
||||
)
|
||||
|
||||
func jobParser(workflow []byte, options ...jobparser.ParseOption) ([]*jobparser.SingleWorkflow, error) {
|
||||
func JobParser(workflow []byte, options ...jobparser.ParseOption) ([]*jobparser.SingleWorkflow, error) {
|
||||
singleWorkflows, err := jobparser.Parse(workflow, false, options...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -200,7 +200,7 @@ jobs:
|
|||
},
|
||||
} {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
sw, err := jobParser([]byte(testCase.workflow))
|
||||
sw, err := JobParser([]byte(testCase.workflow))
|
||||
require.NoError(t, err)
|
||||
for i, sw := range sw {
|
||||
actual, err := sw.Marshal()
|
||||
|
|
@ -396,7 +396,7 @@ func handleWorkflows(
|
|||
Name: dwf.EntryName,
|
||||
}}
|
||||
} else {
|
||||
jobs, err = jobParser(dwf.Content, jobparser.WithVars(vars))
|
||||
jobs, err = actions_module.JobParser(dwf.Content, jobparser.WithVars(vars))
|
||||
if err != nil {
|
||||
log.Info("jobparser.Parse: invalid workflow, setting job status to failed: %v", err)
|
||||
tr := translation.NewLocale(input.Doer.Language)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import (
|
|||
"forgejo.org/models/db"
|
||||
repo_model "forgejo.org/models/repo"
|
||||
"forgejo.org/models/unit"
|
||||
actions_module "forgejo.org/modules/actions"
|
||||
"forgejo.org/modules/log"
|
||||
"forgejo.org/modules/timeutil"
|
||||
webhook_module "forgejo.org/modules/webhook"
|
||||
|
|
@ -168,7 +169,7 @@ func CreateScheduleTask(ctx context.Context, cron *actions_model.ActionSchedule)
|
|||
}
|
||||
|
||||
// Parse the workflow specification from the cron schedule
|
||||
workflows, err := jobParser(cron.Content, jobparser.WithVars(vars))
|
||||
workflows, err := actions_module.JobParser(cron.Content, jobparser.WithVars(vars))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ func (entry *Workflow) Dispatch(ctx context.Context, inputGetter InputValueGette
|
|||
}
|
||||
}
|
||||
|
||||
jobs, err := jobParser(content, jobparser.WithVars(vars), jobparser.WithInputs(inputsAny))
|
||||
jobs, err := actions.JobParser(content, jobparser.WithVars(vars), jobparser.WithInputs(inputsAny))
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue