name: Update openring data
on:
  schedule:
    - cron: '0 0 * * *'
  push:
    branches:
      - openring-test

jobs:
  regenerate-openring-html:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: '^1.15'

      - name: Install openring
        run: go get git.sr.ht/~sircmpwn/openring

      - name: Run openring
        run: ./scripts/openring.sh

      - name: Initialize git config
        run: |
          git config user.name "GitHub Actions"
          git config user.email noreply@github.com

      - name: Compare changes
        run: if [[ $(git diff --stat) != '' ]]; then echo "::set-env name=UPDATED::true"; fi

      - name: Commit and push changes
        run: |
          git add layouts/partials/openring.html

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3
        with:
          commit-message: 'layouts: update openring data'
          branch: update-openring
          base: src
          title: Periodic openring sync
          assignees: msfjarvis

name: Update openring data
on:
  schedule:
    - cron: '0 0 * * *'

jobs:
  regenerate-openring-html:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: '^1.15'

      - name: Install openring
        run: go get git.sr.ht/~sircmpwn/openring

      - name: Run openring
        run: ./scripts/openring.sh

      - name: Initialize git config
        run: |
          git config user.name "GitHub Actions"
          git config user.email noreply@github.com

      - name: Compare changes
        run: if [[ $(git diff --stat) != '' ]]; then echo "::set-env name=UPDATED::true"; fi

      - name: Commit and push changes
        run: |
          git add layouts/partials/openring.html

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3
        with:
          commit-message: 'layouts: update openring data'
          branch: update-openring
          base: src
          title: Periodic openring sync
          assignees: msfjarvis

Revert "[TEMP] github: run openring workflow on pushes to openring-test branch"
Revert "[TEMP] github: run openring workflow on pushes to openring-test branch"

This reverts commit d29189db4f54c11e17c67da7c94374c9a46d14c8.
