prepare for self-hosting #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Re-run up-to-date checks (up-to-date.yml) all on opened PRs | |
# because it won't re-run automaticaly when the master branch | |
# has changed so it the check will be incorrect. | |
name: Re-run Up to date | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
rerun-up-to-date: | |
name: Re-run up-to-date checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Re-run up-to-date checks | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
BRANCHES=$(gh pr list --base ${GITHUB_REF_NAME} --json headRefName --jq '.[].headRefName') | |
echo -e "* Pull request branches:\n$BRANCHES\n" | |
RUNS=$(for i in $BRANCHES; do gh run list -b $i -w up-to-date.yml -L 1 --json databaseId --jq '.[].databaseId'; done) | |
echo -e "* Run IDs:\n$RUNS\n" | |
for i in $RUNS; do | |
gh run cancel $i 2> /dev/null || true | |
gh run watch $i > /dev/null | |
gh run rerun $i | |
echo "* $i re-runned" | |
done |