Battery Bar Functionality #12
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: pre-commit | |
| on: | |
| # Run on push to master | |
| push: | |
| branches: | |
| - master | |
| # Run on pull request actions | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| # Manual trigger | |
| workflow_dispatch: | |
| # Prevent parallel runs | |
| concurrency: | |
| group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | |
| cancel-in-progress: true | |
| # Global env vars | |
| env: | |
| PYTHON_VERSION: "3.12" | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout code and keep creds for push | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: true | |
| # Setup Python | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| # Setup Node.js for JS hooks | |
| - name: Use Node.js 24.x | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "24.x" | |
| # Cache NPM deps | |
| - name: Cache NPM | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-npm- | |
| restore-keys: | | |
| ${{ runner.os }}-npm- | |
| # Cache pip for Python hook installs | |
| - name: Cache pip | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| # Install JS devDependencies | |
| - name: Install devDependencies | |
| run: npm install --legacy-peer-deps | |
| - name: Install specific setuptools version | |
| run: pip install setuptools==81.0.0 | |
| # Run pre-commit in check-only mode (fail on any diffs) | |
| - name: Run pre-commit (check-only) | |
| uses: pre-commit/action@v3.0.1 | |
| with: | |
| args: run --all-files --show-diff-on-failure |