diff --git a/.github/workflows/sorbet.yml b/.github/workflows/sorbet.yml index 6a37b304c9..7bf6cb7c44 100644 --- a/.github/workflows/sorbet.yml +++ b/.github/workflows/sorbet.yml @@ -44,7 +44,6 @@ jobs: git reset --hard origin/master else git checkout -B "$BRANCH" origin/master - BRANCH_EXISTS="1" fi if brew typecheck --update --fail-if-not-changed; then @@ -52,7 +51,8 @@ jobs: git commit -m "sorbet: Update RBI files." \ -m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow." echo "::set-output name=committed::true" - if [ -n "$BRANCH_EXISTS" ]; then + PULL_REQUEST_STATE=$(gh pr view --json=state 2>/dev/null) + if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then echo "::set-output name=pull_request::true" fi fi diff --git a/.github/workflows/spdx.yml b/.github/workflows/spdx.yml index f91e8c16da..c44aee0528 100644 --- a/.github/workflows/spdx.yml +++ b/.github/workflows/spdx.yml @@ -41,14 +41,14 @@ jobs: git reset --hard origin/master else git checkout -B "$BRANCH" origin/master - BRANCH_EXISTS="1" fi if brew update-license-data --fail-if-not-changed; then git add "$GITHUB_WORKSPACE/Library/Homebrew/data/spdx" git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)." echo "::set-output name=committed::true" - if [ -n "$BRANCH_EXISTS" ]; then + PULL_REQUEST_STATE=$(gh pr view --json=state 2>/dev/null) + if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then echo "::set-output name=pull_request::true" fi fi diff --git a/.github/workflows/update-man-completions.yml b/.github/workflows/update-man-completions.yml index e9458a2e0e..dfc27a22b9 100644 --- a/.github/workflows/update-man-completions.yml +++ b/.github/workflows/update-man-completions.yml @@ -49,7 +49,6 @@ jobs: git reset --hard origin/master else git checkout -B "$BRANCH" origin/master - BRANCH_EXISTS="1" fi if [ "${{github.event_name}}" != "push" ]; then @@ -64,7 +63,8 @@ jobs: git commit -m "Update maintainers, manpage and completions." \ -m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/update-man-completions.yml) workflow." echo "::set-output name=committed::true" - if [ -n "$BRANCH_EXISTS" ]; then + PULL_REQUEST_STATE=$(gh pr view --json=state 2>/dev/null) + if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then echo "::set-output name=pull_request::true" fi fi