Skip to content

fix: use v in Lean.toolchain for release versions #13156

fix: use v in Lean.toolchain for release versions

fix: use v in Lean.toolchain for release versions #13156

name: Restart by label
on:
pull_request_target:
types:
- unlabeled
- labeled
jobs:
restart-on-label:
runs-on: ubuntu-latest
if: contains(github.event.label.name, 'merge-ci') ||
contains(github.event.label.name, 'release-ci') ||
contains(github.event.label.name, 'lake-ci') ||
contains(github.event.label.name, 'fsanitize-ci') ||
contains(github.event.label.name, 'macos-arm-ci')
steps:
- run: |
# Finding latest CI workflow run on current pull request
# (unfortunately cannot search by PR number, only base branch,
# and that is't even unique given PRs from forks, but the risk
# of confusion is low and the danger is mild)
echo "Trying to find a run with branch $head_ref and commit $head_sha"
run_id="$(gh run list -e pull_request -b "$head_ref" -c "$head_sha" \
--workflow 'CI' --limit 1 --json databaseId --jq '.[0].databaseId')"
if [[ -z "$run_id" ]]; then
echo "No CI run found for $head_sha, nothing to restart"
exit 0
fi
echo "Run id: ${run_id}"
gh run view "$run_id"
echo "Cancelling (just in case)"
gh run cancel "$run_id" || echo "(failed)"
# `gh run rerun` fails with "This workflow is already running" while the run is still live,
# so wait for the cancellation to land instead of guessing how long it takes
echo "Waiting for the run to finish"
for _ in $(seq 60); do
[[ "$(gh run view "$run_id" --json status --jq '.status')" == completed ]] && break
sleep 10
done
gh run view "$run_id"
echo "Rerunning"
gh run rerun "$run_id"
gh run view "$run_id"
shell: bash
env:
head_ref: ${{ github.head_ref }}
head_sha: ${{ github.event.pull_request.head.sha }}
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}