Files
psf--black/.github/workflows/diff_shades_comment.yml
T
wehub-resource-sync d0aab9212a
test release tool / test-release-tool (macOS-latest, 3.12) (push) Waiting to run
test release tool / test-release-tool (macOS-latest, 3.13) (push) Waiting to run
test release tool / test-release-tool (macOS-latest, 3.14) (push) Waiting to run
test release tool / test-release-tool (macOS-latest, 3.15) (push) Waiting to run
docker / build (linux/arm64) (push) Waiting to run
docker / push (push) Blocked by required conditions
docs / docs (windows-latest) (push) Waiting to run
test release tool / test-release-tool (windows-latest, 3.12) (push) Waiting to run
test release tool / test-release-tool (windows-latest, 3.13) (push) Waiting to run
test release tool / test-release-tool (windows-latest, 3.14) (push) Waiting to run
test release tool / test-release-tool (windows-latest, 3.15) (push) Waiting to run
test / test (macOS-latest, 3.10) (push) Waiting to run
test / test (macOS-latest, 3.11) (push) Waiting to run
test / test (macOS-latest, 3.12.10) (push) Waiting to run
test / test (macOS-latest, 3.13) (push) Waiting to run
test / test (macOS-latest, 3.14) (push) Waiting to run
test / test (macOS-latest, 3.15) (push) Waiting to run
test / test (macOS-latest, pypy3.11-v7.3.22) (push) Waiting to run
test / test (windows-11-arm, 3.11) (push) Waiting to run
test / test (windows-11-arm, 3.12.10) (push) Waiting to run
test / test (windows-11-arm, 3.13) (push) Waiting to run
test / test (windows-11-arm, 3.14) (push) Waiting to run
test / test (windows-11-arm, 3.15) (push) Waiting to run
test / test (windows-latest, 3.10) (push) Waiting to run
test / test (windows-latest, 3.11) (push) Waiting to run
test / test (windows-latest, 3.12.10) (push) Waiting to run
test / test (windows-latest, 3.13) (push) Waiting to run
test / test (windows-latest, 3.14) (push) Waiting to run
test / test (windows-latest, 3.15) (push) Waiting to run
test / test (windows-latest, pypy3.11-v7.3.22) (push) Waiting to run
test / coveralls-finish (push) Blocked by required conditions
test / uvloop (macOS-latest) (push) Waiting to run
test / uvloop (windows-11-arm) (push) Waiting to run
test / uvloop (windows-latest) (push) Waiting to run
fuzz / fuzz (3.11) (push) Failing after 1s
fuzz / fuzz (3.12) (push) Failing after 1s
build and publish / sdist + pure wheel (push) Failing after 0s
diff-shades / analysis / base / ${{ matrix.mode }} (push) Has been skipped
diff-shades / compare / ${{ matrix.mode }} (push) Waiting to run
docs / docs (ubuntu-latest) (push) Failing after 2s
fuzz / fuzz (3.10) (push) Failing after 1s
fuzz / fuzz (3.14) (push) Failing after 0s
lint and format / lint (push) Failing after 1s
build and publish / publish-mypyc (push) Waiting to run
diff-shades / configure (push) Failing after 1s
docker / build (linux/amd64) (push) Has been skipped
diff-shades / analysis / target / ${{ matrix.mode }} (push) Has been skipped
fuzz / fuzz (3.13) (push) Failing after 0s
fuzz / create-issue (push) Waiting to run
build and publish / generate wheels matrix (push) Failing after 0s
test release tool / test-release-tool (ubuntu-latest, 3.13) (push) Failing after 1s
build and publish / mypyc wheels ${{ matrix.only }} (push) Has been skipped
build and publish / publish-hatch (push) Waiting to run
test / test (ubuntu-latest, 3.10) (push) Failing after 0s
test / test (ubuntu-latest, 3.11) (push) Failing after 1s
test / test (ubuntu-latest, 3.13) (push) Failing after 0s
test / test (ubuntu-latest, pypy3.11-v7.3.22) (push) Failing after 1s
test / test (ubuntu-latest, 3.15) (push) Failing after 1s
test release tool / test-release-tool (ubuntu-latest, 3.15) (push) Failing after 0s
zizmor / zizmor (push) Failing after 0s
test release tool / test-release-tool (ubuntu-latest, 3.12) (push) Failing after 4s
test release tool / test-release-tool (ubuntu-latest, 3.14) (push) Failing after 3s
test / uvloop (ubuntu-latest) (push) Failing after 1s
test / test (ubuntu-latest, 3.14) (push) Failing after 1s
test / test (ubuntu-latest, 3.12.10) (push) Failing after 5s
chore: import upstream snapshot with attribution
2026-07-13 12:07:39 +08:00

124 lines
4.3 KiB
YAML

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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
id: artifacts
with:
merge-multiple: true
pattern: ".*.pr-comment.md"
path: ${{ runner.temp }}/diff-shades-artifacts
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
- name: Validate downloaded comment artifacts
id: comment-artifacts
shell: bash
run: |
set -euo pipefail
artifact_dir="${RUNNER_TEMP}/diff-shades-artifacts"
preview_artifact="${artifact_dir}/.preview.pr-comment.md"
stable_artifact="${artifact_dir}/.stable.pr-comment.md"
if [ ! -d "$artifact_dir" ]; then
echo "::error::Artifact directory does not exist: ${artifact_dir}"
exit 1
fi
while IFS= read -r -d '' entry; do
if [ "$(dirname "$entry")" != "$artifact_dir" ]; then
echo "::error::Unexpected nested artifact path: ${entry}"
exit 1
fi
case "$(basename "$entry")" in
.preview.pr-comment.md|.stable.pr-comment.md) ;;
*)
echo "::error::Unexpected artifact path: ${entry}"
exit 1
;;
esac
if [ ! -f "$entry" ] || [ -L "$entry" ]; then
echo "::error::Artifact must be a regular file: ${entry}"
exit 1
fi
done < <(find "$artifact_dir" -mindepth 1 -print0)
for artifact in "$preview_artifact" "$stable_artifact"; do
if [ ! -f "$artifact" ] || [ -L "$artifact" ]; then
echo "::error::Missing expected artifact file: ${artifact}"
exit 1
fi
done
{
echo "preview=${preview_artifact}"
echo "stable=${stable_artifact}"
} >> "$GITHUB_OUTPUT"
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.14"
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" "$preview_artifact" "$stable_artifact"
env:
GITHUB_TOKEN: ${{ github.token }}
pr: ${{ steps.pr.outputs.pr }}
run_id: ${{ github.event.workflow_run.id }}
preview_artifact: ${{ steps.comment-artifacts.outputs.preview }}
stable_artifact: ${{ steps.comment-artifacts.outputs.stable }}
- 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