workflows: don't assume branch existence means the PR is open

This commit is contained in:
Bo Anderson 2021-09-10 02:40:51 +01:00
parent f8d0139015
commit e80620fea4
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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