Skip to content

Commit

Permalink
fix: skip at the top
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Aug 28, 2024
1 parent 494d724 commit 5e5e03f
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions .github/workflows/relock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,37 @@ jobs:
shell: bash -leo pipefail {0}

steps:
# 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 }}

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
if: ${{ steps.check.outputs.skip != 'true' }}

- uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1
if: ${{ steps.check.outputs.skip != 'true' }}
with:
environment-file: conda-lock.yml
environment-name: cf-scripts
condarc-file: autotick-bot/condarc

- name: relock
id: relock
if: ${{ steps.check.outputs.skip != 'true' }}
run: |
python autotick-bot/relock_me.py conda-lock.yml > summary.txt
{
Expand All @@ -35,27 +56,9 @@ jobs:
} >> "$GITHUB_OUTPUT"
rm summary.txt
# 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
if: ${{ steps.check.outputs.skip != 'true' }}
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6
with:
commit-message: relock w/ conda-lock
Expand Down

0 comments on commit 5e5e03f

Please sign in to comment.