name: integration-tests
on:
  workflow_dispatch:
    inputs:
      branch:
        description: 'Specifies the branch which the integration tests should run on.'
        required: true
        default: 'releases/v2'
  schedule:
    - cron: 25 17 * * 0-6
  push:
    tags-ignore:
      - '*.*'
    branches:
      - releases/v*
jobs:
  refresh-api-data:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2.4.0
        with:
          persist-credentials: false

      - name: Fetch Data 📦
        uses: JamesIves/fetch-api-data-action@releases/v2
        with:
          endpoint: https://jsonplaceholder.typicode.com/todos/1
          save-location: fetch-api-data-custom
          save-name: todo
          retry: true

      - name: Build and Deploy Repo 🚀
        uses: JamesIves/github-pages-deploy-action@v4.2.2
        with:
          branch: gh-pages
          folder: fetch-api-data-custom
          target-folder: data
          ssh-key: ${{ secrets.DEPLOY_KEY }}
