Skip to content

Commit eea8c92

Browse files
author
Dominikus Nold
committed
fix: escape GitHub Actions syntax in Jinja2 template
- Use {% raw %} blocks to escape GitHub Actions expressions - Fixes Jinja2 UndefinedError for 'steps' variable - All 5 failing tests now pass Fixes: - test_import_speckit_via_cli_command - test_import_speckit_generates_github_action - test_import_speckit_with_full_workflow - test_generate_from_template - test_generate_github_action
1 parent 9edae7a commit eea8c92

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

resources/templates/github-action.yml.j2

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
id: repro
7575
continue-on-error: true
7676
run: |
77-
specfact repro --verbose --budget ${{ steps.validation.outputs.budget }} || true
77+
specfact repro --verbose --budget {% raw %}${{ steps.validation.outputs.budget }}{% endraw %} || true
7878
echo "exit_code=$?" >> $GITHUB_OUTPUT
7979

8080
- name: Find latest repro report
@@ -92,26 +92,26 @@ jobs:
9292

9393
- name: Create GitHub annotations
9494
id: annotations
95-
if: always() && steps.report.outputs.path != ''
95+
if: always() && {% raw %}steps.report.outputs.path != ''{% endraw %}
9696
run: |
9797
python -m specfact_cli.utils.github_annotations || true
9898

9999
- name: Generate PR comment
100100
id: pr-comment
101-
if: always() && github.event_name == 'pull_request' && steps.report.outputs.path != ''
101+
if: always() && {% raw %}github.event_name == 'pull_request' && steps.report.outputs.path != ''{% endraw %}
102102
run: |
103103
python -m specfact_cli.utils.github_annotations
104104
if [ -f ".specfact/pr-comment.md" ]; then
105105
echo "comment_path=.specfact/pr-comment.md" >> $GITHUB_OUTPUT
106106
fi
107107

108108
- name: Post PR comment
109-
if: always() && github.event_name == 'pull_request' && steps.pr-comment.outputs.comment_path != ''
109+
if: always() && {% raw %}github.event_name == 'pull_request' && steps.pr-comment.outputs.comment_path != ''{% endraw %}
110110
uses: actions/github-script@v7
111111
with:
112112
script: |
113113
const fs = require('fs');
114-
const commentPath = '${{ steps.pr-comment.outputs.comment_path }}';
114+
const commentPath = '{% raw %}${{ steps.pr-comment.outputs.comment_path }}{% endraw %}';
115115
if (fs.existsSync(commentPath)) {
116116
const comment = fs.readFileSync(commentPath, 'utf8');
117117
github.rest.issues.createComment({
@@ -133,7 +133,7 @@ jobs:
133133
if-no-files-found: ignore
134134

135135
- name: Fail workflow if validation failed
136-
if: steps.repro.outputs.exit_code != '0' && steps.validation.outputs.mode == 'block'
136+
if: {% raw %}steps.repro.outputs.exit_code != '0' && steps.validation.outputs.mode == 'block'{% endraw %}
137137
run: |
138138
echo "❌ Validation failed. Exiting with error code."
139139
exit 1

0 commit comments

Comments
 (0)