-
-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (59 loc) · 2.1 KB
/
Copy pathpull_requests.yml
File metadata and controls
74 lines (59 loc) · 2.1 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
71
72
73
74
name: "Pull Request"
on:
pull_request:
branches: [ "main" ]
permissions:
pull-requests: write
env:
LATEST_SCHEDULE_URL: "https://github.com/sportclimbing/event-schedule/releases/latest/download/events-with-schedules.json"
jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v6
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
tools: composer
- name: "Run phpunit"
run: make test
calendar-diff:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v6
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
tools: composer
- name: "Install dependencies"
run: composer install --ignore-platform-reqs --optimize-autoloader
- name: "Download latest schedule"
run: curl -fsSL "${{ env.LATEST_SCHEDULE_URL }}" --output events-with-schedules.json
- name: "Generate Calendar"
run: |
php app/run.php \
--season 2026 \
--output new-calendar.json \
--with-schedule "events-with-schedules.json" \
--format json,ics
- name: "Validate ICS"
run: ./vendor/bin/vobject validate new-calendar.ics
- name: "Check diff"
run: |
curl -sSL "https://github.com/sportclimbing/ifsc-calendar/releases/latest/download/IFSC-World-Cups-and-World-Championships.json" --output old-calendar.json
php bin/calendar-diff old-calendar.json new-calendar.json > diff.md
if [ $(wc -w < diff.md) -gt 0 ]; then
echo "This PR produces the following changes in the calendar" > calendar.diff
cat diff.md >> calendar.diff
else
echo "No changes in the calendar were produced" > calendar.diff
fi
- name: "Comment calendar diff in PR"
uses: thollander/actions-comment-pull-request@v3
with:
file-path: calendar.diff
comment-tag: calendar_diff