From d0fbe4a417438aa8407c1b322870057ecfe11342 Mon Sep 17 00:00:00 2001 From: James Frost Date: Thu, 5 Oct 2023 15:56:31 +0100 Subject: [PATCH 1/2] Use hash of updated lock files in branch name This prevents the workflow failing when the previous branch hasn't been merged. It was finding the branch already existed on the remote and failing. --- .github/workflows/conda-lock.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/conda-lock.yml b/.github/workflows/conda-lock.yml index 35a2e3ec2..8d4673138 100644 --- a/.github/workflows/conda-lock.yml +++ b/.github/workflows/conda-lock.yml @@ -36,7 +36,7 @@ jobs: run: | git config --local user.name "$GITHUB_ACTOR" git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - git switch -c "conda-lock-$(sha256sum ${{ runner.temp }}/lock_file_hashes | head -c 8)" + git switch -c "conda-lock-files" tox -e py39-lock,py310-lock,py311-lock - name: Create pull requests @@ -47,9 +47,10 @@ jobs: echo "Lock files unchanged. Skipping pull request..." exit 0 fi + # Update lock_file_hashes so pushed branch name is unique. + sha256sum requirements/* > ${{ runner.temp }}/lock_file_hashes git add requirements/locks/*.txt git commit -m "[CI] Update conda lock files" - git push --set-upstream origin "conda-lock-$(sha256sum ${{ runner.temp }}/lock_file_hashes | head -c 8)" + git push --set-upstream origin "conda-lock-files:conda-lock-$(sha256sum ${{ runner.temp }}/lock_file_hashes | head -c 8)" # Create PR on GitHub using GitHub CLI. - gh pr create --base main --title "[CI] Update conda lock files" \ - --body "Created automatically by GitHub Actions." + gh pr create --base main --title "[CI] Update conda lock files" --body "Created automatically by GitHub Actions." From 63f320b5437181ae005869f9042c043d56daa690 Mon Sep 17 00:00:00 2001 From: James Frost Date: Tue, 7 Nov 2023 15:17:22 +0000 Subject: [PATCH 2/2] Pin runner to python 3.11 to avoid crash Issue tracked at https://github.com/conda/conda-lock/issues/542 --- .github/workflows/conda-lock.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda-lock.yml b/.github/workflows/conda-lock.yml index 8d4673138..a8e4eae41 100644 --- a/.github/workflows/conda-lock.yml +++ b/.github/workflows/conda-lock.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.11" - name: Install dependencies run: python3 -m pip install tox tox-conda