name: Generate Listings
on:
  push:
    paths:
      - 'emoji/**'
      - 'create_listing.py'
    branches:
      - master
jobs:
  generate:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

      - name: Set up Python
        uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        with:
          python-version: '3.12'

      - name: Generate listings
        run: python3 create_listing.py

      - name: Commit changes
        run: |
          git config --local user.email "github-actions[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"
          git add README.md index.html
          git diff --staged --quiet || git commit -m "Update listings"
          git push
