-
Notifications
You must be signed in to change notification settings - Fork 11
70 lines (65 loc) · 2.27 KB
/
Copy pathgallery_notify.yml
File metadata and controls
70 lines (65 loc) · 2.27 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Gallery link maintenance
on:
schedule:
- cron: "17 3 * * *"
workflow_dispatch:
push:
branches:
- master
paths:
- "src/data/gallery/**"
- "scripts/check-gallery-links.mjs"
- "scripts/notify-gallery-links.mjs"
- ".github/workflows/gallery_check.yml"
- ".github/workflows/gallery_notify.yml"
- "package.json"
- "yarn.lock"
permissions:
contents: read
concurrency:
group: gallery-link-maintenance-${{ github.ref_name }}
cancel-in-progress: false
env:
REPORT_PATH: /tmp/gallery-link-report.json
STATE_PATH: .cache/gallery-link-state.json
jobs:
gallery-maintenance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "22"
- run: yarn
- name: Prepare state directory
run: mkdir -p "$(dirname "$STATE_PATH")"
- name: Restore notification state
uses: actions/cache@v4
with:
path: ${{ env.STATE_PATH }}
key: gallery-link-state-${{ github.repository }}-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
gallery-link-state-${{ github.repository }}-${{ github.ref_name }}-
- name: Check gallery links
id: checker
continue-on-error: true
run: yarn test:gallery-links --report "$REPORT_PATH"
- name: Notify gallery link failures
id: notifier
if: ${{ always() }}
env:
DISCORD_GALLERY_WEBHOOK_URL: ${{ secrets.DISCORD_GALLERY_WEBHOOK_URL }}
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: yarn notify-gallery-links --report "$REPORT_PATH" --state "$STATE_PATH" --workflow-url "$WORKFLOW_URL"
- name: Save notification state
if: ${{ always() && steps.notifier.outcome == 'success' }}
uses: actions/cache/save@v4
with:
path: ${{ env.STATE_PATH }}
key: gallery-link-state-${{ github.repository }}-${{ github.ref_name }}-${{ github.run_id }}
- name: Preserve maintenance result
if: ${{ always() }}
run: |
if [ "${{ steps.checker.outcome }}" != "success" ] || [ "${{ steps.notifier.outcome }}" != "success" ]; then
exit 1
fi