From dd54be601f9305fdf5c5c12f6502a4214cfb0e42 Mon Sep 17 00:00:00 2001 From: beckermr Date: Wed, 28 Aug 2024 04:37:01 -0500 Subject: [PATCH] fix: always update for deps and skip making PR if it already exists --- .github/workflows/relock.yml | 23 +++++++++++++++++++++-- autotick-bot/relock_me.py | 4 ---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/relock.yml b/.github/workflows/relock.yml index a52909e6a..ebb8f0190 100644 --- a/.github/workflows/relock.yml +++ b/.github/workflows/relock.yml @@ -35,7 +35,26 @@ jobs: } >> "$GITHUB_OUTPUT" rm summary.txt - - name: Open PR + # https://stackoverflow.com/a/73828715/1745538 + - name: skip if PR already exists + id: check + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --head 'relock-deps' \ + --base 'master' \ + --json title \ + --jq 'length') + if [[ ${prs} != "0" ]]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi + env: + GH_TOKEN: ${{ secrets.AUTOTICK_BOT_TOKEN }} + + - name: open PR + if: ${{ steps.check.outputs.skip != 'true' }} id: pr uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6 with: @@ -53,7 +72,7 @@ jobs: labels: dependencies - name: automerge - if: ${{ steps.pr.outputs.pull-request-number != '' }} + if: ${{ steps.check.outputs.skip != 'true' && steps.pr.outputs.pull-request-number != '' }} run: gh pr merge --merge --auto "${{ steps.pr.outputs.pull-request-number }}" env: GH_TOKEN: ${{ secrets.AUTOTICK_BOT_TOKEN }} diff --git a/autotick-bot/relock_me.py b/autotick-bot/relock_me.py index 3d4ce3ccd..d37318509 100644 --- a/autotick-bot/relock_me.py +++ b/autotick-bot/relock_me.py @@ -106,10 +106,6 @@ def main(lockfile, reformat_only, force): for spec in envyml["dependencies"]: spec = MatchSpec(spec) - # we always pull the latest on the fly when the bot runs - if spec.name == "conda-forge-pinning": - continue - for platform in envyml["platforms"]: if old_platform_pkg_to_ver[platform].get( spec.name