Mise à jour GTFS #103
This file contains 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: Mise à jour GTFS | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "30 14 * * 1,3,5" # Runs on Monday, Wednesday and Friday at 14:30 UTC | |
env: | |
MD_VALIDATOR_VERSION: 5.0.1 | |
GTFS_PATH: stq-qc-ca.gtfs.zip | |
jobs: | |
gtfs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Prepare node | |
run: |- | |
npm install | |
npm run prepare | |
- name: Generate GTFS | |
run: node src/index.js | |
- id: vars | |
name: Set variables for pull request | |
run: |- | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
timestamp=$(date -u) | |
# Set title and body for PR | |
echo "pr_timestamp=${timestamp}" >> $GITHUB_OUTPUT | |
echo "pr_title=Latest data: ${timestamp}" >> $GITHUB_OUTPUT | |
echo "pr_body=Les données ont été mises à jour!" >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: Latest data ${{steps.vars.outputs.pr_timestamp}} | |
title: ${{ steps.vars.outputs.pr_title }} | |
body: ${{ steps.vars.outputs.pr_body }} | |
branch: latest-gtfs | |
delete-branch: true | |
validate: | |
needs: gtfs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '17' | |
- name: Get validator | |
run: | | |
curl -sSL https://github.com/MobilityData/gtfs-validator/releases/download/v$MD_VALIDATOR_VERSION/gtfs-validator-$MD_VALIDATOR_VERSION-cli.jar -o gtfs-validator.jar | |
- name: Run validator | |
run: | | |
java -jar gtfs-validator.jar -i $GTFS_PATH -o validation-results | |
- name: Check validation results | |
run: | | |
node tests/check-validation-results.js validation-results/report.json | |