hooks: use AWK instead of jq for better portability

Some systems don't have jq installed, and using something like
`nix-shell` in the shebang would make this script noticeably slower.

We're not using `grep` because it lacks `-P` flag on MacOS.

Resolves: https://github.com/status-im/status-mobile/issues/13322

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-09-05 12:51:26 +02:00
parent 7e94f534b6
commit 8fe5e5f73c
No known key found for this signature in database
GPG Key ID: 09AA5403E54D9931
1 changed files with 2 additions and 2 deletions

View File

@ -6,8 +6,8 @@ if [[ -z $(git diff --cached --name-only -r | grep status-go-version.json) ]]; t
fi
MERGE_BASE=$(git merge-base -a develop "$(git rev-parse --abbrev-ref HEAD)" develop)
GO_COMMIT_MERGE_BASE=$(git show "${MERGE_BASE}":status-go-version.json | jq -r '."commit-sha1"')
GO_COMMIT_CURRENT=$(jq -r '."commit-sha1"' status-go-version.json)
GO_COMMIT_MERGE_BASE=$(git show "${MERGE_BASE}":status-go-version.json | awk -F'"' '/commit-sha1/{print $4}')
GO_COMMIT_CURRENT=$(awk -F'"' '/commit-sha1/{print $4}' status-go-version.json)
GITHUB_LINK_PREFIX="https://github.com/status-im/status-go/compare/"
# Link to the current StatusGo changelog being updated.
GITHUB_LINK="${GITHUB_LINK_PREFIX}${GO_COMMIT_MERGE_BASE::8}...${GO_COMMIT_CURRENT::8}"