name: Emojiscraper

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * 0' # Runs every Sunday at midnight UTC

jobs:
  run-emojiscraper:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: 1.23

      - name: Run emojiscraper
        run: make emojiscraper

      - name: Format code
        run: make format

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v5
        with:
          token: ${{ secrets.PAT }}
          branch: emojiscraper-updates
          commit-message: Update from weekly emojiscraper run
          title: "Weekly Emojiscraper Update"
          body: "Automated update from the weekly Emojiscraper run."
