Skip to content

relock

relock #2135

Workflow file for this run

name: relock
on:
workflow_dispatch: null
schedule:
- cron: '*/30 * * * *'
concurrency: relock
jobs:
relock:
name: relock
runs-on: "ubuntu-latest"
outputs:
relocked: ${{ steps.relock.outputs.relocked }}
summary: ${{ steps.relock.outputs.summary }}
steps:
- name: download env and lockfile
run: |
wget https://raw.githubusercontent.com/regro/cf-scripts/main/environment.yml
wget https://raw.githubusercontent.com/regro/cf-graph-countyfair/master/conda-lock.yml || :
- name: relock env
id: relock
uses: beckermr/relock-conda@49530e32234db1af2014b31a9e7c484488ec5daa
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
action: file
- name: upload conda-lock.yml to artifact
if: steps.relock.outputs.relocked == 'true'
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
with:
name: conda-lock.yml
path: conda-lock.yml
tests:
needs: relock
if: needs.relock.outputs.relocked == 'true'
uses: regro/cf-scripts/.github/workflows/tests-reusable.yml@main
with:
lockfile: conda-lock.yml
lockfile-is-artifact: true
secrets:
CODECOV_TOKEN: ""
push:
needs: [relock, tests]
if: needs.relock.outputs.relocked == 'true'
runs-on: ubuntu-latest
steps:
- name: download conda-lock.yml
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: conda-lock.yml
path: new-lockfile
- name: commit and push changes
run: |
git clone --depth=5 https://github.com/regro/cf-graph-countyfair.git
cd cf-graph-countyfair
mv ../new-lockfile/conda-lock.yml conda-lock.yml
rm -rf new-lockfile
git config --global user.name regro-cf-autotick-bot
git config --global user.email [email protected]
git config --global pull.rebase false
git config --global push.autoSetupRemote true
git add conda-lock.yml
git commit -m "relock w/ conda-lock.yml"
for i in `seq 1 5`; do
git pull -s recursive -X theirs --no-edit --commit || :
git push https://x-access-token:${GH_TOKEN}@github.com/regro/cf-graph-countyfair.git master || :
done
cd ..
set -x
git clone --depth=5 https://github.com/regro/cf-scripts.git
cd cf-scripts
found_one=false
for pkg in \
conda-forge-feedstock-ops \
conda conda-build \
mamba \
rattler-build \
conda-forge-feedstock-check-solvable \
conda-libmamba-solver \
conda-forge-metadata \
conda-smithy \
conda-package-handling; \
do
val=$(echo "${SUMMARY}" | grep "${pkg}" || echo "")
if [[ "${val}" != "" ]]; then
found_one=true
fi
done
if [[ "${found_one}" == "true" ]]; then
git checkout -b relock-env-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}
git commit -m "rebuild for new conda-lock.yml file" --allow-empty
for i in `seq 1 5`; do
git pull -s recursive -X theirs --no-edit --commit || :
git push https://x-access-token:${GH_TOKEN}@github.com/regro/cf-scripts.git main || :
done
pr_url=$(gh pr -R regro/cf-scripts create -B main -H relock-env-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER} --fill)
gh pr -R regro/cf-scripts merge ${pr_url} --admin # we already tested above so skip merge queue
fi
cd ..
env:
SUMMARY: ${{ needs.relock.outputs.summary }}
TOKEN: ${{ secrets.AUTOTICK_BOT_TOKEN }}