name: Refresh Dataset
on:
  schedule:
    - cron: '12 2 * * *'                                                    (1)
jobs:
  build:
    name: Refresh Dataset
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/[email protected]                                           (2)
      - name: Fetch dataset archive
        run: curl -o archive.zip https://api.511.org/transit/datafeeds?api_key=$&operator_id=RG (3)
      - name: Extract files of interest from the archive
        run: unzip -o -j archive.zip agency.txt routes.txt stop_times.txt stops.txt trips.txt -d ./infrastructure/data/current (4)
      - name: Remove archive
        run: rm archive.zip                                                 (5)
      - name: Create PR
        uses: peter-evans/[email protected]                            (6)
        with:
          commit-message: Update to latest data files
          branch: data/refresh
          delete-branch: true
          title: Refresh data files to latest version
          body: ""