getCompiledSchema returns the compiled GitHub Actions schema, compiling it once and caching
()
| 59 | |
| 60 | // getCompiledSchema returns the compiled GitHub Actions schema, compiling it once and caching |
| 61 | func getCompiledSchema() (*jsonschema.Schema, error) { |
| 62 | compiledSchemaOnce.Do(func() { |
| 63 | schemaValidationLog.Print("Compiling GitHub Actions schema (first time)") |
| 64 | compiledSchema, schemaCompileError = compileSchema( |
| 65 | githubWorkflowSchema, |
| 66 | "https://json.schemastore.org/github-workflow.json", |
| 67 | ) |
| 68 | if schemaCompileError == nil { |
| 69 | schemaValidationLog.Print("GitHub Actions schema compiled successfully") |
| 70 | } |
| 71 | }) |
| 72 | |
| 73 | return compiledSchema, schemaCompileError |
| 74 | } |
| 75 | |
| 76 | // validateGitHubActionsSchema validates the generated YAML content against the GitHub Actions workflow schema |
| 77 | func (c *Compiler) validateGitHubActionsSchema(yamlContent string) error { |
no test coverage detected