Skip to content

Commit 778a89d

Browse files
committed
Combine SHA for lock and pyproject.toml to simplify logic
1 parent 28bcb21 commit 778a89d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,20 @@ runs:
5858
echo "ImageOS=$ImageOS"
5959
echo "ImageVersion=$ImageVersion"
6060
POETRY_ENV_PATH=$(poetry config virtualenvs.path)
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
61+
POETRY_SHA=$(cat pyproject.toml poetry.lock | sha256sum | cut -f 1 -d " ") #Remove trailing dash
6362
# output to GITHUB_OUTPUT
6463
echo "IMAGE_OS=$ImageOS" >> $GITHUB_OUTPUT
6564
echo "IMAGE_VERSION=$ImageVersion" >> $GITHUB_OUTPUT
6665
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
66+
echo "POETRY_SHA=$POETRY_SHA" >> $GITHUB_OUTPUT
6967
7068
- name: Cache Poetry environment
7169
if: inputs.use-cache == 'true'
7270
id: cache-poetry-env
7371
uses: actions/cache@v4
7472
with:
7573
path: ${{ steps.setup-cache-variables.outputs.POETRY_ENV_PATH }}
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 }}
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 }}
7775

7876
- name: Poetry install with extras
7977
working-directory: ${{ inputs.working-directory }}

0 commit comments

Comments
 (0)