-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.58 KB
/
Copy pathpr-visual-diff.yml
File metadata and controls
51 lines (45 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: PR Visual Diff
on:
pull_request:
paths:
- 'skins/**/*.png'
permissions:
contents: write
pull-requests: write
jobs:
generate-diff:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python dependencies
run: pip install Pillow
- name: Generate Visual Diff
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.number }}
run: python scripts/pr-diff.py
- name: Upload artifacts and post comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
run: |
git fetch origin pr-artifacts || true
git checkout pr-artifacts 2>/dev/null || git checkout --orphan pr-artifacts
git rm -rf . > /dev/null 2>&1 || true
mkdir -p pr-$PR_NUMBER
while IFS= read -r file; do
filename=$(basename "$file")
cp "$file" pr-$PR_NUMBER/"$filename"
done < artifact-files.txt
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.github.com"
git add .
git commit -m "Artifacts for PR #$PR_NUMBER" || echo "No changes to commit"
git push -f origin pr-artifacts
sed -i 's|diff-images/||g' pr_comment.md
gh pr comment $PR_NUMBER --body-file pr_comment.md