name: diff-shades comment on: workflow_run: workflows: [diff-shades] types: [completed] permissions: {} jobs: comment: runs-on: ubuntu-latest # We want to comment even if there were failed files or the stable style changed # That would cause the main workflow to "fail" if: github.event.workflow_run.event == 'pull_request' && contains(fromJSON('["success", "failure"]'), github.event.workflow_run.conclusion) permissions: pull-requests: write # Needed to comment on PR steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 id: artifacts with: merge-multiple: true pattern: ".*.pr-comment.md" github-token: ${{ github.token }} run-id: ${{ github.event.workflow_run.id }} - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: "3.13" pip-version: "25.3" pip-install: --group diff-shades-comment - name: Get PR number id: pr run: echo pr=$(gh pr list --search $sha --json number --jq ".[0].number") >> "$GITHUB_OUTPUT" env: GITHUB_TOKEN: ${{ github.token }} sha: ${{ github.event.workflow_run.head_sha }} - name: Get details from initial workflow run id: metadata run: | python scripts/diff_shades_gha_helper.py comment-details \ $pr $run_id $(echo .*.pr-comment.md) env: GITHUB_TOKEN: ${{ github.token }} pr: ${{ steps.pr.outputs.pr }} run_id: ${{ github.event.workflow_run.id }} - name: Try to find pre-existing PR comment id: find-comment uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0 with: issue-number: ${{ steps.pr.outputs.pr }} comment-author: "github-actions[bot]" body-includes: "diff-shades" - name: Create or update PR comment uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 with: comment-id: ${{ steps.find-comment.outputs.comment-id }} issue-number: ${{ steps.pr.outputs.pr }} body: ${{ steps.metadata.outputs.comment-body }} edit-mode: replace