1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 09:23:21 +01:00

Fix prep-deps CI step (#20312)

The CI job `prep-deps` was broken in #20096 for forks and non-PR builds
(e.g. the `develop` branch builds). Non-PR builds were broken because
of the `set -u` flag, which complained about a PR-specific environment
variable being unset. Fork builds were broken because the draft check
relied upon secrets (which aren't included in CI runs on forks).

The script is now tolerant of missing environment variables, and skips
the draft check for forks.
This commit is contained in:
Mark Stacey 2023-07-31 20:36:14 -02:30 committed by GitHub
parent 3b0d37c3bf
commit 36b1991b44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,15 +1,17 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}"
if [ -n "$PR_NUMBER" ]
IS_NON_FORK_DRAFT='false'
if [[ -n $CIRCLE_PULL_REQUEST ]] && gh auth status
then
IS_DRAFT="$(gh pr view --json isDraft --jq '.isDraft' "$PR_NUMBER")"
else
IS_DRAFT='false'
PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}"
if [ -n "$PR_NUMBER" ]
then
IS_NON_FORK_DRAFT="$(gh pr view --json isDraft --jq '.isDraft' "$PR_NUMBER")"
fi
fi
# Build query to see whether there are any "preview-like" packages in the manifest
@ -29,7 +31,7 @@ else
HAS_PREVIEW_BUILDS='false'
fi
if [[ $IS_DRAFT == 'true' && $HAS_PREVIEW_BUILDS == 'true' ]]
if [[ $IS_NON_FORK_DRAFT == 'true' && $HAS_PREVIEW_BUILDS == 'true' ]]
then
# Use GitHub registry on draft PRs, allowing the use of preview builds
echo "Installing with preview builds"