PR Comment #133
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
| --- | |
| name: PR Comment | |
| on: | |
| workflow_run: | |
| workflows: ["PR validation"] | |
| types: | |
| - completed | |
| jobs: | |
| comment: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| if: > | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: lint-results | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| - name: Read lint results | |
| id: lint-results | |
| run: | | |
| HAS_WARNINGS=$(cat has-warnings.txt) | |
| PR_NUMBER=$(cat pr-number.txt) | |
| echo "has_warnings=$HAS_WARNINGS" >> $GITHUB_OUTPUT | |
| echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT | |
| - name: Comment on PR | |
| if: steps.lint-results.outputs.has_warnings == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const prNumber = ${{ steps.lint-results.outputs.pr_number }}; | |
| const jobUrl = `${{ github.event.workflow_run.html_url }}`; | |
| github.rest.issues.createComment({ | |
| issue_number: prNumber, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `⚠️ **Warnings found but no fatal errors.**\n\nSee the [job summary](${jobUrl}) for details.` | |
| }); |