name: Compress Images

on:
  pull_request:
    paths:
      - "**.jpg"
      - "**.jpeg"
      - "**.png"
      - "**.webp"

jobs:
  build:
    # Only run on Pull Requests within the same repository, and not from forks.
    if: github.event.pull_request.head.repo.full_name == github.repository
    name: calibreapp/image-actions
    runs-on: ubuntu-latest
    steps:
      - name: Clone repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
        with:
          persist-credentials: false

      - name: Compress Images
        uses: calibreapp/image-actions@f32575787d333b0579f0b7d506ff03be63a669d1 #1.4.1 TODO: if they start using a tag like v1, switch to that
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
