Skip to content

Commit e745915

Browse files
committed
test ci
1 parent e77e469 commit e745915

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/prevent-deletion.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ jobs:
1414
checks: write
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Check out
17+
- name: Checkout base
1818
uses: actions/checkout@v3
19-
with:
20-
fetch-depth: 0
21-
- name: Check changes
19+
- name: Fetch head
2220
run: |
23-
if git diff --name-only --diff-filter 'D' '${{ github.event.pull_request.base.sha }}' '${{ github.event.pull_request.head.sha }}' | grep -E '^media/.*\.(jpg|png|jpeg|gif)$' >/tmp/changed_files; then
21+
git remote add head ${{ github.event.pull_request.head.repo.clone_url }}
22+
git fetch --depth=1 head ${{ github.event.pull_request.head.ref }}
23+
- name: Find changes
24+
run: |
25+
git rev-parse '${{ github.event.pull_request.head.sha }}'
26+
if git diff --name-only --diff-filter 'D' HEAD '${{ github.event.pull_request.head.sha }}' | grep -E '^media/.*\.(jpg|png|jpeg|gif)$' >/tmp/changed_files; then
2427
cat /tmp/changed_files
25-
echo '{"name":"Image","head_sha":"${{ github.event.pull_request.head.sha }}","status":"completed","conclusion":"failure"}' > /tmp/body.json
28+
echo '{"name":"Image Deletion Check","head_sha":"${{ github.event.pull_request.head.sha }}","status":"completed","conclusion":"failure"}' > /tmp/body.json
2629
jq \
2730
--arg count "$(wc -l /tmp/changed_files | awk '{print $1}')" \
2831
--arg summary "$(cat /tmp/changed_files | sed 's/^/- /')" \
@@ -33,10 +36,11 @@ jobs:
3336
fi
3437
- name: Publish result
3538
run: |
39+
cat /tmp/body2.json
3640
curl \
3741
-sSL \
3842
-X POST \
3943
-H "Accept: application/vnd.github+json" \
4044
-H "Authorization: token ${{ github.token }}" \
41-
'https://api.github.com/repos/${{ github.repository }}/check-runs' \
42-
-T '/tmp/body2.json'
45+
-T '/tmp/body2.json' \
46+
'https://api.github.com/repos/${{ github.repository }}/check-runs'

0 commit comments

Comments
 (0)