Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing PR #20096 #20103

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -341,27 +341,9 @@ jobs:
# required and add the new dependencies, and the cache will be persisted.
- dependency-cache-v1-
- gh/install
- run:
name: Set IS_DRAFT environment variable
command: |
PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}"
if [ -n "$PR_NUMBER" ]
then
echo "IS_DRAFT=$(gh pr view --json isDraft --jq '.isDraft' "$PR_NUMBER")" >> "$BASH_ENV"
source "$BASH_ENV"
else
echo "Not a PR; skipping"
fi
- run:
name: Install dependencies
command: |
if [[ $IS_DRAFT == 'true' ]]
then
# Use GitHub registry on draft PRs, allowing the use of preview builds
METAMASK_NPM_REGISTRY=https://npm.pkg.github.com yarn --immutable
else
yarn --immutable
fi
command: .circleci/scripts/install-dependencies.sh
- save_cache:
key: dependency-cache-v1-{{ checksum "yarn.lock" }}
paths:
Expand Down
40 changes: 40 additions & 0 deletions .circleci/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

set -e
set -u
set -o pipefail

PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}"
if [ -n "$PR_NUMBER" ]
then
IS_DRAFT="$(gh pr view --json isDraft --jq '.isDraft' "$PR_NUMBER")"
else
IS_DRAFT='false'
fi

# Build query to see whether there are any "preview-like" packages in the manifest
# A "preview-like" package is a `@metamask`-scoped package with a prerelease version that has no period.
QUERY='.dependencies + .devDependencies' # Get list of all dependencies
QUERY+=' | with_entries( select(.key | startswith("@metamask") ) )' # filter to @metamask-scoped packages
QUERY+=' | to_entries[].value' # Get version ranges
QUERY+=' | select(test("^\\d+\\.\\d+\\.\\d+-[^.]+$"))' # Get pinned versions where the prerelease part has no "."

# Use `-e` flag so that exit code indicates whether any matches were found
if jq -e "${QUERY}" < ./package.json
then
echo "Preview builds detected"
HAS_PREVIEW_BUILDS='true'
else
echo "No preview builds detected"
HAS_PREVIEW_BUILDS='false'
fi

if [[ $IS_DRAFT == 'true' && $HAS_PREVIEW_BUILDS == 'true' ]]
then
# Use GitHub registry on draft PRs, allowing the use of preview builds
echo "Installing with preview builds"
METAMASK_NPM_REGISTRY=https://npm.pkg.github.com yarn --immutable
else
echo "Installing without preview builds"
yarn --immutable
fi
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@
"@ethersproject/bignumber": "^5.7.0",
"@lavamoat/allow-scripts": "^2.0.3",
"@lavamoat/lavapack": "^5.2.0",
"@metamask/auto-changelog": "^2.1.0",
"@metamask/auto-changelog": "3.2.0",
"@metamask/eslint-config": "^9.0.0",
"@metamask/eslint-config-jest": "^9.0.0",
"@metamask/eslint-config-mocha": "^9.0.0",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3906,17 +3906,17 @@ __metadata:
languageName: node
linkType: hard

"@metamask/auto-changelog@npm:^2.1.0":
version: 2.6.1
resolution: "@metamask/auto-changelog@npm:2.6.1"
"@metamask/auto-changelog@npm:3.2.0":
version: 3.2.0
resolution: "@metamask/auto-changelog@npm:3.2.0"
dependencies:
diff: ^5.0.0
execa: ^5.1.1
semver: ^7.3.5
yargs: ^17.0.1
bin:
auto-changelog: dist/cli.js
checksum: 6ae84de492e4aec710ff2dd793f258b7cc3aba3fdeb416c0d3ab55a156da61b4ccd3272e9a6608f32b71695dc42b527a380ce62566e387240665556c8da26de3
checksum: 7cd19400bb60d478455fbf9ffe7c295b21df64764a01f90776beda04bfa46242f34751112b862b4bd5955f04a7d28cfa7d6b2e745f3d3baaccda7c493f761658
languageName: node
linkType: hard

Expand Down Expand Up @@ -24205,7 +24205,7 @@ __metadata:
"@metamask/announcement-controller": ^4.0.0
"@metamask/approval-controller": ^3.4.0
"@metamask/assets-controllers": ^9.2.0
"@metamask/auto-changelog": ^2.1.0
"@metamask/auto-changelog": 3.2.0
"@metamask/base-controller": ^3.2.0
"@metamask/browser-passworder": ^4.1.0
"@metamask/contract-metadata": ^2.3.1
Expand Down
Loading