name: Graphs CI
on:
  schedule:
    - cron: "0 0 * * *"
  repository_dispatch:
    types: [graphs]
jobs:
  release:
    name: Generate graphs
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}
          token: ${{ secrets.GH_PAT }}
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14
      - name: Install dependencies
        run: npm ci
      - name: Run script
        run: npm run graphs
        env:
          GH_PAT: ${{ secrets.GH_PAT }}
          SECRET_SITE: ${{ secrets.SECRET_SITE }}
      - name: Commit new data
        uses: stefanzweifel/git-auto-commit-action@v4.1.1
        with:
          commit_message: ":bento: Update graphs [skip ci]"
          commit_user_name: Koj Bot
          commit_user_email: bot@koj.co
          commit_author: Koj Bot <bot@koj.co>
