Skip to content

Commit

Permalink
Use jq // alternate operator
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed Feb 23, 2020
1 parent 8f4f585 commit 6505ab5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions unknown-words.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,9 @@ bullet_words() {
echo "$1" | perl -pne 's/^(.)/* $1/'
rm -f "$run_warnings"
export tokens="$1"
base=$(cat $GITHUB_EVENT_PATH | jq -r '.pull_request.base.sha' -M || echo HEAD^)
if [ "$base" = "null" ]; then
base=$(cat $GITHUB_EVENT_PATH |jq -r '.before' -M)
fi
base=$(cat $GITHUB_EVENT_PATH | jq -r '.pull_request.base.sha // .before // "HEAD^"' -M)
if [ "$base" != "HEAD^" ]; then
head=$(cat $GITHUB_EVENT_PATH | jq -r '.pull_request.head.sha' -M || echo HEAD^)
head=$(cat $GITHUB_EVENT_PATH | jq -r '.pull_request.head.sha' -M)
if [ "$head" = "null" ]; then
head=${GITHUB_SHA:-HEAD}
fi
Expand Down

0 comments on commit 6505ab5

Please sign in to comment.