Set up husky.net #13
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: git-hooks | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| jobs: | |
| husky: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/actions/bootstrap | |
| # Restore dotnet tools (includes Husky) | |
| - name: Restore dotnet tools | |
| run: dotnet tool restore | |
| # Install Husky (sets up hooks path) | |
| - name: Install Husky | |
| run: dotnet husky install | |
| - run: npm ci | |
| working-directory: src/Elastic.Documentation.Site | |
| # Get changed files | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0 | |
| # Run Husky hooks with changed files as arguments | |
| - name: Run pre-commit hooks | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| run: dotnet husky run --group pre-commit --args "${{ steps.changed-files.outputs.all_changed_files }}" | |
| - name: Run pre-push hooks | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| run: dotnet husky run --group pre-push --args "${{ steps.changed-files.outputs.all_changed_files }}" |