Skip to content

feat: faster reaction via cli (#208) #44

feat: faster reaction via cli (#208)

feat: faster reaction via cli (#208) #44

Workflow file for this run

name: test-command
on:
push:
branches:
- main
pull_request: null
concurrency:
group: test-command
cancel-in-progress: false
jobs:
test-command:
name: test relock command
runs-on: "ubuntu-latest"
if: github.event.pull_request.title != 'relock w/ conda-lock'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.TEST_PAT }}
- name: backup lock file
run: |
gh pr checkout 112
cp conda-lock.yml ../conda-lock-backup.yml
env:
GH_TOKEN: ${{ secrets.TEST_PAT }}
- name: move relock code to current branch
run: |
if [[ "${IS_PR}" == "true" ]]; then
branch=pull/${{ github.event.number }}/head
else
branch=main
fi
git checkout main
sed -i \
"s#conda-incubator/relock-conda@main#conda-incubator/relock-conda@${branch}#g" \
.github/workflows/relock.yml
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .github/workflows/relock.yml
git commit -m "[ci skip] move relock code to current branch for testing" --allow-empty
git push
env:
IS_PR: ${{ github.event_name == 'pull_request' }}
- name: trigger relock via comment
run: |
gh pr comment 112 --body "/relock-conda"
env:
GH_TOKEN: ${{ secrets.TEST_PAT }}
- name: wait for relock
run: |
sleep 60
- name: check for updates
run: |
gh pr checkout 112
diffval=$(diff conda-lock.yml ../conda-lock-backup.yml || :)
if [[ "${diffval}" == "" ]]; then
echo "no relock happened!"
exit 1
fi
env:
GH_TOKEN: ${{ secrets.TEST_PAT }}
- name: cleanup
if: always()
run: |
if [[ "${IS_PR}" == "true" ]]; then
branch=pull/${{ github.event.number }}/head
else
branch=main
fi
git checkout main
sed -i \
"s#conda-incubator/relock-conda@${branch}#conda-incubator/relock-conda@main#g" \
.github/workflows/relock.yml
git add .github/workflows/relock.yml
git commit -m "[ci skip] move relock code back to main" --allow-empty
git push
gh pr checkout 112
cp ../conda-lock-backup.yml conda-lock.yml
git add conda-lock.yml
git commit -m "[ci skip] restore old lock file" --allow-empty
git push
env:
GH_TOKEN: ${{ secrets.TEST_PAT }}
IS_PR: ${{ github.event_name == 'pull_request' }}