diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c6d437a0d165..249c220653c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,6 +60,11 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Get Python version + run: | + version=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:3])))") + echo "PYTHON_VERSION=$version" >> $GITHUB_ENV + - name: Get Poetry version from poetry-version run: | version=$(cat poetry-version) @@ -83,7 +88,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.cache/pre-commit - key: ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set poetry cache-dir run: echo "POETRY_CACHE_DIR=$(poetry config cache-dir)" >> $GITHUB_ENV @@ -93,7 +98,7 @@ jobs: uses: actions/cache@v4 with: path: ${{ env.POETRY_CACHE_DIR }} - key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-poetry-${{ hashFiles('**/poetry.lock') }} - name: Run pre-commit run: | @@ -240,6 +245,11 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Get Python version + run: | + version=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:3])))") + echo "PYTHON_VERSION=$version" >> $GITHUB_ENV + - name: Get Poetry version from poetry-version run: | version=$(cat poetry-version) @@ -258,7 +268,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.cache/pre-commit - key: ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set poetry cache-dir run: echo "POETRY_CACHE_DIR=$(poetry config cache-dir)" >> $GITHUB_ENV @@ -268,7 +278,7 @@ jobs: uses: actions/cache@v4 with: path: ${{ env.POETRY_CACHE_DIR }} - key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-poetry-${{ hashFiles('**/poetry.lock') }} - name: Run pre-commit run: |