This commit introduces the ability to show previews for PRs by any author. It works as follows: - The build artifacts of all PRs are uploaded to the preview server. - Automatically verified PRs (i.e. from trusted authors or having a specific label) are deployed and publicly accessible as usual. - PRs that could not be automatically verified are stored for later use (after re-verification). - A PR can be marked as "trusted" and make its preview publicly accessible by adding the GitHub label specified in the `AIO_TRUSTED_PR_LABEL` env var of the preview server. At the moment, there is no automatic mechanism for notifying the preview server about changes to the PR's verification status. The PR's "visibility" will be checked and updated every time a new build is uploaded.
27 lines
712 B
Bash
Executable File
27 lines
712 B
Bash
Executable File
#!/bin/bash
|
|
set -eux -o pipefail
|
|
|
|
# Set up env
|
|
source "`dirname $0`/_env.sh"
|
|
|
|
# Build `scripts-js/`
|
|
(
|
|
cd "$SCRIPTS_JS_DIR"
|
|
yarn install
|
|
yarn build
|
|
)
|
|
|
|
# Preverify PR
|
|
AIO_GITHUB_ORGANIZATION="angular" \
|
|
AIO_GITHUB_TEAM_SLUGS="angular-core,aio-contributors" \
|
|
AIO_GITHUB_TOKEN=$(echo ${GITHUB_TEAM_MEMBERSHIP_CHECK_KEY} | rev) \
|
|
AIO_REPO_SLUG=$TRAVIS_REPO_SLUG \
|
|
AIO_TRUSTED_PR_LABEL="aio: preview" \
|
|
AIO_PREVERIFY_PR=$TRAVIS_PULL_REQUEST \
|
|
node "$SCRIPTS_JS_DIR/dist/lib/upload-server/index-preverify-pr"
|
|
|
|
# Exit codes:
|
|
# - 0: The PR can be automatically trusted (i.e. author belongs to trusted team or PR has the "trusted PR" label).
|
|
# - 1: An error occurred.
|
|
# - 2: The PR cannot be automatically trusted.
|