Skip to content

Commit f441829

Browse files
committed
fix: escape chars
1 parent 1f65457 commit f441829

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

_posts/2024-08-21-adding-comments-to-pr.markdown

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@ and upload the generated data as an artifact. See the snippet below for the rele
6262
with:
6363
script: |
6464
const fs = require('fs');
65-
const COVERAGE_PERCENTAGE = `${{ env.COVERAGE_PERCENTAGE }}`;
66-
const COVERAGE_REPORT_PATH = `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/`;
65+
const COVERAGE_PERCENTAGE = `\${{ env.COVERAGE_PERCENTAGE }}`;
66+
const COVERAGE_REPORT_PATH = `https://github.com/${{ github.repository }}/actions/runs/\${{ github.run_id }}/`;
6767

6868
fs.mkdirSync('./pr-comment', { recursive: true });
6969

70-
var pr_number = `${{ github.event.number }}`;
70+
var pr_number = `\${{ github.event.number }}`;
7171
var body = `
7272
Code coverage report is ready! :chart_with_upwards_trend:
7373

74-
- **Code Coverage Percentage:** ${COVERAGE_PERCENTAGE}%
75-
- **Code Coverage Report:** [View Coverage Report](${COVERAGE_REPORT_PATH})
74+
- **Code Coverage Percentage:** \${COVERAGE_PERCENTAGE}%
75+
- **Code Coverage Report:** [View Coverage Report](\${COVERAGE_REPORT_PATH})
7676
`;
7777

7878
fs.writeFileSync('./pr-comment/pr-number.txt', pr_number);
@@ -118,7 +118,7 @@ jobs:
118118
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
119119
owner: context.repo.owner,
120120
repo: context.repo.repo,
121-
run_id: ${{github.event.workflow_run.id }},
121+
run_id: \${{github.event.workflow_run.id }},
122122
});
123123
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
124124
return artifact.name == "pr-comment"
@@ -130,12 +130,12 @@ jobs:
130130
archive_format: 'zip',
131131
});
132132
var fs = require('fs');
133-
fs.writeFileSync('${{github.workspace}}/pr-comment.zip', Buffer.from(download.data));
133+
fs.writeFileSync('\${{github.workspace}}/pr-comment.zip', Buffer.from(download.data));
134134
- run: unzip pr-comment.zip
135135
- name: 'Comment on PR'
136136
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
137137
with:
138-
github-token: ${{ secrets.GITHUB_TOKEN }}
138+
github-token: \${{ secrets.GITHUB_TOKEN }}
139139
script: |
140140
var fs = require('fs');
141141

0 commit comments

Comments
 (0)