name: Validate/Deploy Data

on:
  push: { branches: [master] }

jobs:
  validate-then-deploy:
    name: Validate, then deploy data
    runs-on: ubuntu-latest
    env:
      task: GH_PAGES
    steps:
      - uses: actions/setup-node@master
        with: {node-version: ^12.0}
      - name: Check out the code
        uses: actions/checkout@master
      - name: Unshallow the history
        run: git fetch --prune --unshallow
      - name: Install dependencies
        run: yarn install --frozen-lockfile
      - name: Validate the data
        run: |
          npm run validate-bus-data
          npm run validate-data
      # Having validated the data, we now prepare a bundle.  This script creates
      # files in a docs/ directory.
      - name: Bundle the data
        run: npm run bundle-data
      # Notes: actions/checkout@v2 no longer fetches entire history nor enters
      # detached HEAD state.  We really just need to check out an (orphaned)
      # branch and then add, commit, and push the appropriate directory.
      - name: Commit the data
        run: |
          git checkout --orphan "gh-pages-$GITHUB_SHA"
          git --work-tree=docs add .
          git commit --author="Data Deployment Bot <>" -m "Automated data deployment at $(date -Is)"
          git show --stat HEAD
      # If the previous commit successfully happened
      - name: Deploy the data
        run:
          git push --force-with-lease origin "gh-pages-$GITHUB_SHA:gh-pages"

name: Validate/Deploy Data

on:
  push: { branches: [master] }

jobs:
  validate-then-deploy:
    name: Validate, then deploy data
    runs-on: ubuntu-latest
    env:
      task: GH_PAGES
    steps:
      - uses: actions/setup-node@master
        with: {node-version: ^12.0}
      - name: Check out the code
        uses: actions/checkout@master
      - name: Install dependencies
        run: yarn install --frozen-lockfile
      - name: Validate the data
        run: |
          npm run validate-bus-data
          npm run validate-data
      # Having validated the data, we now prepare a bundle.  This script creates
      # files in a docs/ directory.
      - name: Bundle the data
        run: npm run bundle-data
      # Notes: actions/checkout@v2 no longer fetches entire history nor enters
      # detached HEAD state.  We really just need to check out an (orphaned)
      # branch and then add, commit, and push the appropriate directory.
      - name: Commit the data
        run: |
          git checkout --orphan "gh-pages-$GITHUB_SHA"
          git --work-tree=docs add .
          git commit --author="Data Deployment Bot <>" -m "Automated data deployment at $(date -Is)"
          git show --stat HEAD
      # If the previous commit successfully happened, download the latest state
      # of the remote branch gh-pages.
      - name: Deploy the data
        run: |
          git fetch --prune --unshallow origin gh-pages
          git push --force-with-lease origin "gh-pages-$GITHUB_SHA:gh-pages"

Move unshallowing to right before the push
ci: Move unshallowing to right before the push

Signed-off-by: Kristofer Rye <1ed31cfd0b53bc3d1689a6fee6dbfc9507dffd22@gmail.com>
