Skip to content

Commit 314179b

Browse files
committed
Add SHA of pyproject.toml to determine cache key in python-environment GitHub action
1 parent 1ac2892 commit 314179b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.github/actions/python-environment/action.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,22 @@ runs:
5858
echo "ImageOS=$ImageOS"
5959
echo "ImageVersion=$ImageVersion"
6060
POETRY_ENV_PATH=$(poetry config virtualenvs.path)
61-
POETRY_SHA=$(sha256sum poetry.lock | awk '{print $1}') #Remove trailing filename
62-
echo "POETRY_ENV_PATH=$POETRY_ENV_PATH" >> $GITHUB_OUTPUT
61+
POETRY_LOCK_SHA=$(sha256sum poetry.lock | awk '{print $1}') #Remove trailing filename
62+
PYPROJECT_SHA=$(sha256sum pyproject.toml | awk '{print $1}') #Remove trailing filename
63+
# output to GITHUB_OUTPUT
6364
echo "IMAGE_OS=$ImageOS" >> $GITHUB_OUTPUT
6465
echo "IMAGE_VERSION=$ImageVersion" >> $GITHUB_OUTPUT
65-
echo "POETRY_SHA=$POETRY_SHA" >> $GITHUB_OUTPUT
66-
66+
echo "POETRY_ENV_PATH=$POETRY_ENV_PATH" >> $GITHUB_OUTPUT
67+
echo "POETRY_LOCK_SHA=$POETRY_LOCK_SHA" >> $GITHUB_OUTPUT
68+
echo "PYPROJECT_SHA=PYPROJECT_SHA" >> $GITHUB_OUTPUT
6769
6870
- name: Cache Poetry environment
6971
if: inputs.use-cache == 'true'
7072
id: cache-poetry-env
7173
uses: actions/cache@v4
7274
with:
7375
path: ${{ steps.setup-cache-variables.outputs.POETRY_ENV_PATH }}
74-
key: poetry-env-${{ steps.setup-cache-variables.outputs.POETRY_SHA }}-${{ steps.setup-cache-variables.outputs.IMAGE_OS }}-${{ steps.setup-cache-variables.outputs.IMAGE_VERSION }}-${{ runner.arch }}-${{ inputs.poetry-version }}-${{ inputs.python-version }}-${{ inputs.extras }}
76+
key: poetry-env-${{ steps.setup-cache-variables.outputs.POETRY_LOCK_SHA }}-${{ steps.setup-cache-variables.outputs.PYPROJECT_SHA }}-${{ steps.setup-cache-variables.outputs.IMAGE_OS }}-${{ steps.setup-cache-variables.outputs.IMAGE_VERSION }}-${{ runner.arch }}-${{ inputs.poetry-version }}-${{ inputs.python-version }}-${{ inputs.extras }}
7577

7678
- name: Poetry install with extras
7779
working-directory: ${{ inputs.working-directory }}

doc/changes/unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This releases fixes Nox session `release:prepare` for multi-project repositories
88

99
* #580: Fixed Nox session `release:prepare` for multi-project repositories
1010
* #586: Fixed `python-environment` GitHub action to use working-directory for setup of cache variables
11+
* #559: Added SHA of `pyproject.toml` to determine cache key in `python-environment` GitHub action
1112

1213
## Features
1314

0 commit comments

Comments
 (0)