diff --git a/.github/workflows/pre-commit-audit.yml b/.github/workflows/pre-commit-audit.yml index 870e50e..c7f797b 100644 --- a/.github/workflows/pre-commit-audit.yml +++ b/.github/workflows/pre-commit-audit.yml @@ -8,7 +8,7 @@ permissions: contents: read jobs: - prek: + prek-audit: name: Run prek runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pre-commit-manual.yml b/.github/workflows/pre-commit-manual.yml index f9ff4f6..f7f5839 100644 --- a/.github/workflows/pre-commit-manual.yml +++ b/.github/workflows/pre-commit-manual.yml @@ -14,7 +14,7 @@ permissions: contents: read jobs: - prek: + prek-manual: name: Run prek runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 64a185f..7b3930a 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,22 +14,8 @@ permissions: contents: read jobs: - prek: - name: 🏃🏼 prek on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - steps: - - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - name: Setup Bun - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 - with: - bun-version: 1.3.11 - - name: Run standard prek hooks - uses: j178/prek-action@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1 - with: - extra-args: '--all-files' + prek-standard: + uses: ./.github/workflows/reusable-prek.yml + with: + skip_hooks: editorconfig-checker,yamllint' + extra_args: '--all-files --verbose' diff --git a/.github/workflows/reusable-prek.yml b/.github/workflows/reusable-prek.yml new file mode 100644 index 0000000..ffcac40 --- /dev/null +++ b/.github/workflows/reusable-prek.yml @@ -0,0 +1,45 @@ +--- +name: Reusable prek + +on: + workflow_call: + inputs: + extra_args: + description: 'Arguments to pass to the prek command' + required: false + type: string + default: '--all-files' + skip_hooks: + description: 'Comma-separated list of hooks to skip' + required: false + type: string + default: '' + +permissions: + contents: read + +jobs: + prek: + name: 🏃🏼 prek on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + steps: + - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Setup Bun + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 + with: + bun-version: 1.3.11 + + - name: Run standard prek hooks + uses: j178/prek-action@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1 + # We use a conditional env variable to handle the SKIP logic + env: + SKIP: ${{ (matrix.os == 'windows-latest' && inputs.skip_hooks != '') && inputs.skip_hooks || '' }} + with: + extra-args: ${{ inputs.extra_args }}