ics refactor #93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |