From e6596187f332c1d8f5231762d655ba6dc89475bd Mon Sep 17 00:00:00 2001 From: Iisakki Rotko Date: Tue, 9 Apr 2024 11:53:14 +0200 Subject: [PATCH] ci: update missing ci lock files when not running on scheudle --- .github/workflows/test.yaml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 78104a14a..54e37fdf4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -515,27 +515,25 @@ jobs: ref: ${{ github.head_ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }} - - name: Prepare - id: prepare - run: | - if [ -d .ci-package-locks ]; then - echo "LOCKS_EXIST=true" >> "$GITHUB_OUTPUT" - else - echo "LOCKS_EXIST=false" >> "$GITHUB_OUTPUT" - fi - - uses: actions/download-artifact@v4 - if: github.event_name == 'schedule' || steps.prepare.outputs.LOCKS_EXIST == 'false' with: pattern: ci-package-locks-* merge-multiple: true - - name: Update CI package locks - if: github.event_name == 'schedule' || steps.prepare.outputs.LOCKS_EXIST == 'false' + - name: Prepare + id: prepare + # We check if lock files have changed. This should only be the case if we are either running on a schedule + # or if some lock files did not exist yet. run: | git config user.name 'github-actions[bot]' git config user.email 'github-actions[bot]@users.noreply.github.com' + git add -n .ci-package-locks + git diff --quiet || echo "HAS_DIFF=true" >> "$GITHUB_OUTPUT" + + - name: Update CI package locks + if: steps.prepare.outputs.HAS_DIFF == 'true' + run: | git add .ci-package-locks git commit -m "Update CI package locks" git push