Skip to content

Desktop on Windows: a closed approval prompt says approval, and is told by exit code 1223 #84

Desktop on Windows: a closed approval prompt says approval, and is told by exit code 1223

Desktop on Windows: a closed approval prompt says approval, and is told by exit code 1223 #84

name: Release note edited
# A pull request's release note is in its description (scripts/release-note-check.ts), and editing a
# description starts no CI run. So when the description changes after CI's run of the pull request's
# head has finished with its `release note` check failed, this re-runs that run's failed jobs: the
# check reads the description again, and `verify` follows it. Nothing else runs again, since every
# other job of the run passed or is re-run only because it failed. While the run is still going,
# nothing is needed: the check runs last and reads the description then.
#
# Pull requests from this repository: a fork's token is read-only and cannot re-run. A maintainer
# re-runs a fork's failed jobs by hand.
on:
pull_request:
types: [edited]
permissions: {}
concurrency:
group: release-note-edited-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
rerun:
name: re-run the release note
if: >-
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.changes.body != null
runs-on: ubuntu-latest
timeout-minutes: 5 # seconds
permissions:
# To read CI's runs and re-run one.
actions: write
steps:
- name: Re-run CI's failed release note on the pull request's head
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
run="$(gh api "repos/$REPOSITORY/actions/workflows/ci.yml/runs?head_sha=$HEAD_SHA&event=pull_request&per_page=1" \
--jq '.workflow_runs[0] | select(.) | "\(.id) \(.status)"')"
if [ -z "$run" ]; then
echo "CI has not run on $HEAD_SHA yet. Its release note check will read this description."
exit 0
fi
id="${run% *}"
status="${run#* }"
if [ "$status" != completed ]; then
echo "CI's run $id is still going. Its release note check runs last and reads this description."
exit 0
fi
note="$(gh api "repos/$REPOSITORY/actions/runs/$id/jobs?filter=latest&per_page=100" \
--jq '[.jobs[] | select(.name == "release note")][0].conclusion // ""')"
if [ "$note" != failure ]; then
echo "CI's run $id has its release note check at '${note:-not run}'. Nothing to re-run."
exit 0
fi
gh run rerun "$id" --failed --repo "$REPOSITORY"
echo "Re-ran the failed jobs of CI's run $id, so the release note check reads the edited description."