mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-30 08:09:15 +01:00
73e0fdddd0
The `.sh` file extension is now used for all Bash scripts. This ensures the files are recognized as Bash scripts by the ShellCheck CI job, and by editors/IDEs for improved syntax highlighting.
53 lines
1.2 KiB
Bash
Executable File
53 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
set -u
|
|
set -o pipefail
|
|
|
|
if [[ "${CI:-}" != 'true' ]]
|
|
then
|
|
printf '%s\n' 'CI environment variable must be set to true'
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "${CIRCLECI:-}" != 'true' ]]
|
|
then
|
|
printf '%s\n' 'CIRCLECI environment variable must be set to true'
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z "${GITHUB_TOKEN:-}" ]]
|
|
then
|
|
printf '%s\n' 'GITHUB_TOKEN environment variable must be set'
|
|
exit 1
|
|
fi
|
|
|
|
function install_github_cli ()
|
|
{
|
|
printf '%s\n' 'Installing hub CLI'
|
|
pushd "$(mktemp -d)"
|
|
curl -sSL 'https://github.com/github/hub/releases/download/v2.11.2/hub-linux-amd64-2.11.2.tgz' | tar xz
|
|
PATH="$PATH:$PWD/hub-linux-amd64-2.11.2/bin"
|
|
popd
|
|
}
|
|
|
|
base_branch='develop'
|
|
|
|
if [[ -n "${CI_PULL_REQUEST:-}" ]]
|
|
then
|
|
printf '%s\n' 'CI_PULL_REQUEST is set, pull request already exists for this build'
|
|
exit 0
|
|
fi
|
|
|
|
install_github_cli
|
|
|
|
printf '%s\n' "Creating a Pull Request to sync 'master' with 'develop'"
|
|
|
|
if ! hub pull-request \
|
|
--message "Master => develop" --message 'Merge latest release back into develop' \
|
|
--base "$CIRCLE_PROJECT_USERNAME:$base_branch" \
|
|
--head "$CIRCLE_PROJECT_USERNAME:$CIRCLE_BRANCH";
|
|
then
|
|
printf '%s\n' 'Pull Request already exists'
|
|
fi
|