1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +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 #!/usr/bin/env bash
set -e set -e
set -u
set -o pipefail set -o pipefail
PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}" IS_NON_FORK_DRAFT='false'
if [ -n "$PR_NUMBER" ]
if [[ -n $CIRCLE_PULL_REQUEST ]] && gh auth status
then then
IS_DRAFT="$(gh pr view --json isDraft --jq '.isDraft' "$PR_NUMBER")" PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}"
else if [ -n "$PR_NUMBER" ]
IS_DRAFT='false' then
IS_NON_FORK_DRAFT="$(gh pr view --json isDraft --jq '.isDraft' "$PR_NUMBER")"
fi
fi fi
# Build query to see whether there are any "preview-like" packages in the manifest # Build query to see whether there are any "preview-like" packages in the manifest
@ -29,7 +31,7 @@ else
HAS_PREVIEW_BUILDS='false' HAS_PREVIEW_BUILDS='false'
fi fi
if [[ $IS_DRAFT == 'true' && $HAS_PREVIEW_BUILDS == 'true' ]] if [[ $IS_NON_FORK_DRAFT == 'true' && $HAS_PREVIEW_BUILDS == 'true' ]]
then then
# Use GitHub registry on draft PRs, allowing the use of preview builds # Use GitHub registry on draft PRs, allowing the use of preview builds
echo "Installing with preview builds" echo "Installing with preview builds"