name: "PCC Watch"

on:
  workflow_dispatch:
  schedule:
    - cron: "17 3 * * *" # daily at 03:17 UTC

permissions:
  contents: write

jobs:
  watch:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          fetch-depth: 0
      - name: Set up Go
        uses: actions/setup-go@v7
        with:
          go-version: "1.26"
      - name: Run ipsw watch PCC vphone600 firmware
        run: |
          go run ./cmd/ipsw/main.go watch pcc \
          --interval 0 \
          --state hack/.pcc_watch_state \
          --discord \
          --discord-id ${{ secrets.DISCORD_ID }} \
          --discord-token ${{ secrets.DISCORD_TOKEN }}
      - uses: stefanzweifel/git-auto-commit-action@4a55954c782fc1ea30b9056cd3e7a2b40ca8887d # v5
        with:
          commit_message: Update PCC watch state
          file_pattern: hack/.pcc_watch_state
