From 86766661eb88d19c045324ad8303f4766f5755f0 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Sun, 26 Mar 2023 17:44:05 +0100 Subject: [PATCH] Fix release script merge delay --- .github/workflows/release.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d79b5077..ab71b2897 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,11 +74,44 @@ jobs: - name: "Commit new version number" uses: EndBug/add-and-commit@v9 + id: commit with: default_author: github_actions message: Update version number add: 'fbt_options.py scripts/version.py' + - name: "Wait for checks to pass" + run: | + ${{ steps.commit.outputs.pushed }} + sha="${{ steps.commit.outputs.commit_long_sha }}" + + while [ "$new" != "$sha" ]; do + sleep 1 + new="$(curl -s https://api.github.com/repos/${{ github.event.pull_request.base.repo.full_name }}/pulls/${{ github.event.pull_request.number }} | jq -r ".head.sha")" + done + + checks="$(curl -s https://api.github.com/repos/${{ github.event.pull_request.base.repo.full_name }}/branches/main | jq -r ".protection.required_status_checks.contexts[]")" + for check in $checks; do + found=false + while ! $found; do + sleep 1 + suites="$(curl -s https://api.github.com/repos/${{ github.event.pull_request.head.repo.full_name }}/commits/$sha/check-suites | jq -r ".check_suites[].check_runs_url")" + for suite in $suites; do + completed=false + while ! $completed; do + sleep 1 + run="$(curl -s $suite | jq -r '.check_runs[] | select(.name == "$check")')" + [ "$run" != "" ] || continue 2 + found=true + [ "$(echo "$run" | jq -r ".status")" = "completed" ] || continue + completed=true + [ "$(echo "$run" | jq -r ".conclusion")" = "success" ] + done + done + done + done + + - name: "Merge pull request" uses: "pascalgn/automerge-action@v0.15.6" env: