Skip to content

Commit 74df2bb

Browse files
committed
fix: Replace github-script with gh CLI for PR comments
Replace the complex github-script action with a simple gh CLI command to avoid YAML parsing issues with JavaScript template literals. Issue: Invalid workflow file: .github/workflows/chart-lock-check.yaml#L64 You have an error in your yaml syntax on line 64 Root Cause: GitHub's YAML parser was having issues with the JavaScript template literal string concatenation inside the github-script action, even though it was technically valid. Solution: Use the GitHub CLI (gh) which is pre-installed on GitHub runners: gh pr comment ${{ github.event.pull_request.number }} --body "..." Benefits: ✅ No JavaScript/YAML escaping conflicts ✅ Simpler and more readable ✅ Native multi-line string support ✅ No external action dependency (uses built-in gh CLI) ✅ Same functionality, cleaner implementation
1 parent e7f732d commit 74df2bb

File tree

1 file changed

+36
-33
lines changed

1 file changed

+36
-33
lines changed

.github/workflows/chart-lock-check.yaml

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,39 +48,42 @@ jobs:
4848
4949
- name: Add comment to PR
5050
if: steps.check.outputs.has_dev_version == 'true'
51-
uses: actions/github-script@v7
52-
with:
53-
script: |
54-
await github.rest.issues.createComment({
55-
issue_number: context.issue.number,
56-
owner: context.repo.owner,
57-
repo: context.repo.repo,
58-
body: '## ❌ Chart.lock Contains 0.0.0-dev Entries\n\n' +
59-
'Found `0.0.0-dev` entries in `Chart.lock` that must be removed.\n\n' +
60-
'**Why this is a problem:**\n' +
61-
'The `kata-as-coco-runtime-for-ci` dependency uses `version: 0.0.0-dev` which is:\n' +
62-
'- Only for CI testing\n' +
63-
'- Not a real release\n' +
64-
'- Should never be committed to Chart.lock\n\n' +
65-
'**How to fix:**\n\n' +
66-
'Manually edit Chart.lock to remove the entire dependency block containing `version: 0.0.0-dev`:\n\n' +
67-
'```yaml\n' +
68-
'# Remove this entire block from Chart.lock:\n' +
69-
'- name: kata-deploy\n' +
70-
' repository: oci://ghcr.io/kata-containers/kata-deploy-charts\n' +
71-
' version: 0.0.0-dev\n' +
72-
'```\n\n' +
73-
'Then commit and push:\n' +
74-
'```bash\n' +
75-
'git add Chart.lock\n' +
76-
'git commit -m "fix: Remove 0.0.0-dev from Chart.lock"\n' +
77-
'git push\n' +
78-
'```\n\n' +
79-
'**Why not regenerate with helm dependency update?**\n' +
80-
'Running `helm dependency update` would add the 0.0.0-dev entry back. This entry only exists for CI testing and should never be in Chart.lock.\n\n' +
81-
'**Prevention:**\n' +
82-
'Chart.lock is managed by CI/CD workflows. Don\'t manually run `helm dependency update` - the prepare-release script handles updates correctly.'
83-
});
51+
run: |
52+
gh pr comment ${{ github.event.pull_request.number }} --body "## ❌ Chart.lock Contains 0.0.0-dev Entries
53+
54+
Found \`0.0.0-dev\` entries in \`Chart.lock\` that must be removed.
55+
56+
**Why this is a problem:**
57+
The \`kata-as-coco-runtime-for-ci\` dependency uses \`version: 0.0.0-dev\` which is:
58+
- Only for CI testing
59+
- Not a real release
60+
- Should never be committed to Chart.lock
61+
62+
**How to fix:**
63+
64+
Manually edit Chart.lock to remove the entire dependency block containing \`version: 0.0.0-dev\`:
65+
66+
\`\`\`yaml
67+
# Remove this entire block from Chart.lock:
68+
- name: kata-deploy
69+
repository: oci://ghcr.io/kata-containers/kata-deploy-charts
70+
version: 0.0.0-dev
71+
\`\`\`
72+
73+
Then commit and push:
74+
\`\`\`bash
75+
git add Chart.lock
76+
git commit -m \"fix: Remove 0.0.0-dev from Chart.lock\"
77+
git push
78+
\`\`\`
79+
80+
**Why not regenerate with helm dependency update?**
81+
Running \`helm dependency update\` would add the 0.0.0-dev entry back. This entry only exists for CI testing and should never be in Chart.lock.
82+
83+
**Prevention:**
84+
Chart.lock is managed by CI/CD workflows. Don't manually run \`helm dependency update\` - the prepare-release script handles updates correctly."
85+
env:
86+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8487

8588
- name: Fail if 0.0.0-dev found
8689
if: steps.check.outputs.has_dev_version == 'true'

0 commit comments

Comments
 (0)