Skip to content

Commit

Permalink
Support GitHub registry for draft PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gudahtt committed Nov 17, 2022
1 parent cbebe2f commit 316615d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ executors:
docker:
- image: koalaman/shellcheck-alpine@sha256:dfaf08fab58c158549d3be64fb101c626abc5f16f341b569092577ae207db199

orbs:
gh: circleci/github-cli@2.0

workflows:
test_and_release:
jobs:
Expand Down Expand Up @@ -209,6 +212,27 @@ jobs:
- checkout
- restore_cache:
key: dependency-cache-v1-{{ checksum "yarn.lock" }}
- 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: Setup registry config for using package previews on draft PRs
command: |
if [[ $IS_DRAFT == 'true' ]]
then
printf '%s\n\n%s' '@metamask:registry=https://npm.pkg.github.com' "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGE_READ_TOKEN}" > .npmrc
else
echo "Not draft; skipping GitHub registry setup"
fi
- run:
name: Install deps
command: |
Expand Down

0 comments on commit 316615d

Please sign in to comment.