diff --git a/.github/workflows/comment-check.yml b/.github/workflows/comment-check.yml index b0a810e..328d5db 100644 --- a/.github/workflows/comment-check.yml +++ b/.github/workflows/comment-check.yml @@ -69,12 +69,27 @@ jobs: - name: Comment on PR if errors found if: failure() # This step runs only if the previous step fails - uses: peter-evans/create-or-update-comment@v4.0.0 + uses: actions/github-script@v6 with: - token: ${{ secrets.GITHUB_TOKEN }} # GitHub token to post the comment - issue-number: ${{ github.event.pull_request.number }} # PR number - body: | - ⚠️ Non-English comments were found in the following locations: - ``` - ${{ steps.check-comments.outputs.non_english_comments }} - ``` \ No newline at end of file + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const path = 'non_english_comments.txt'; + const issueNumber = context.payload.pull_request.number; + + if (fs.existsSync(path)) { + const comments = fs.readFileSync(path, 'utf8'); + const body = ` + ⚠️ Non-English comments were found in the following locations: + \`\`\` + ${comments} + \`\`\` + `; + + await github.issues.createComment({ + ...context.repo, + issue_number: issueNumber, + body: body + }); + } + \ No newline at end of file