name: GoReleaser Dry Run

permissions:
  contents: read

on:
  pull_request:
    paths:
      - ".github/workflows/releaser*.yml"
      - ".goreleaser.yml"
      - "cmd/**"
      - "go.mod"
      - "go.sum"
      - "internal/**"
      - "pkg/**"

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  dry-run:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
        with:
          fetch-depth: 0

      - name: Install Go
        uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
        with:
          go-version-file: "go.mod"

      - name: Setup caches
        uses: ./.github/actions/setup-caches
        timeout-minutes: 5
        continue-on-error: true

      - uses: anchore/sbom-action/download-syft@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0

      - name: Run GoReleaser dry run
        uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
        with:
          version: latest
          args: release --snapshot --clean --skip=publish,sign --timeout 90m
        env:
          GITHUB_TOKEN: ${{ github.token }}
