Continue refactor of pyspark tests (#12007) #2
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: XGBoost CI (Pre-commit) | |
| on: [push, pull_request] | |
| permissions: | |
| contents: read | |
| jobs: | |
| pre-commit: | |
| name: Run pre-commit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install pre-commit | |
| run: python -m pip install pre-commit | |
| - name: Run pre-commit on updated files | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| FROM_REF="${{ github.event.pull_request.base.sha }}" | |
| TO_REF="${{ github.event.pull_request.head.sha }}" | |
| else | |
| FROM_REF="${{ github.event.before }}" | |
| TO_REF="${{ github.sha }}" | |
| fi | |
| if [ "${FROM_REF}" = "0000000000000000000000000000000000000000" ]; then | |
| FROM_REF="$(git hash-object -t tree /dev/null)" | |
| fi | |
| pre-commit run --from-ref "${FROM_REF}" --to-ref "${TO_REF}" --show-diff-on-failure |