Fix YAML syntax error in generated devsecops.yml templates#6
Merged
shenxianpeng merged 2 commits intomainfrom Mar 28, 2026
Merged
Fix YAML syntax error in generated devsecops.yml templates#6shenxianpeng merged 2 commits intomainfrom
shenxianpeng merged 2 commits intomainfrom
Conversation
…nted heredoc content Agent-Logs-Url: https://github.com/castops/cast-cli/sessions/b35d00c1-9cd4-47ef-9ef7-00514a042b26 Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix syntax error in devsecops.yml file
Fix YAML syntax error in generated devsecops.yml templates
Mar 28, 2026
There was a problem hiding this comment.
Pull request overview
Fixes YAML parsing errors in generated DevSecOps pipeline templates by removing shell heredocs embedded inside YAML run: | blocks and instead writing the default Rego policy from a YAML literal block scalar.
Changes:
- GitHub Actions templates: move the default Rego policy into a step-level
env.DEFAULT_REGOYAML literal block and write it usingprintf. - GitLab CI templates: add a job-level
variables.DEFAULT_REGOYAML literal block and write it usingprintf.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| templates/python/devsecops.yml | Replaces heredoc-based policy generation with env.DEFAULT_REGO + printf to avoid YAML scalar termination issues. |
| templates/nodejs/devsecops.yml | Same GitHub Actions fix: multiline env var for the default Rego policy + printf writer. |
| templates/go/devsecops.yml | Same GitHub Actions fix: multiline env var for the default Rego policy + printf writer. |
| templates/gitlab/python/devsecops.yml | Same fix for GitLab CI using variables.DEFAULT_REGO on cast-gate and writing via printf. |
| templates/gitlab/nodejs/devsecops.yml | Same GitLab CI fix using job variables + printf. |
| templates/gitlab/go/devsecops.yml | Same GitLab CI fix using job variables + printf. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shell heredocs inside
run: |blocks require content at column 0, which YAML block scalars interpret as ending the scalar — causing a parse error at thepackage mainline in the embedded Rego policy. All 6 templates (3 GitHub, 3 GitLab) were broken.Changes
cat <<'REGO'heredoc in the "Write default policy" step with anenvvariable holding the Rego content as a YAML literal block scalar, written viaprintf:variablesblock on thecast-gatejob instead of step-levelenv.📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.