name: "Quality Control: Trunk Cache"

permissions:
  contents: read
  actions: write

on:
  workflow_dispatch:
  push:
    branches:
      - main
    paths:
      - .trunk/trunk.yaml
      - .github/workflows/trunk.cache.yml
  schedule:
    - cron: "0 9 * * 1" # 9am Tooling Monday

concurrency:
  group: ${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  trunk-cache:
    name: Trunk Cache
    runs-on: ${{ vars.RUNS_ON || 'ubuntu-latest' }}
    permissions:
      actions: write
    steps:
      - uses: benzine-framework/action-setup-php@main
      - name: "Trunk Cache"
        uses: trunk-io/trunk-action@v1
        with:
          check-mode: populate_cache_only