|
1 | 1 | #!/bin/bash |
2 | 2 | # See: https://docs.gitlab.com/ee/user/project/push_options.html |
3 | 3 |
|
4 | | -# Push and create GitHub PR, then wait for CI build to finish |
5 | | -gpsp() ( |
6 | | - set -euo pipefail |
7 | | - git push |
| 4 | +# Push, open a GitHub PR, and surface the latest pipeline status in Chrome. |
| 5 | +_git_push_create_pr_and_open_pipeline() { |
| 6 | + git push "$@" |
8 | 7 | gh pr create --fill || true |
9 | 8 | gh pr view --web |
10 | 9 |
|
11 | | - local CURRENT_GIT_BRANCH CURRENT_GIT_COMMIT |
12 | | - CURRENT_GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" |
13 | | - CURRENT_GIT_COMMIT="$(git rev-parse HEAD)" |
14 | | - PIPELINE_URL="$(./scripts/circleci_pipeline_status -f "%u" -b "$CURRENT_GIT_BRANCH" -c "$CURRENT_GIT_COMMIT")" |
15 | | - local CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" |
16 | | - "$CHROME_BIN" "${PIPELINE_URL}" 2>/dev/null |
| 10 | + local current_git_branch current_git_commit pipeline_url |
| 11 | + current_git_branch="$(git rev-parse --abbrev-ref HEAD)" |
| 12 | + current_git_commit="$(git rev-parse HEAD)" |
| 13 | + pipeline_url="$(./scripts/circleci_pipeline_status -f "%u" -b "$current_git_branch" -c "$current_git_commit")" |
| 14 | + local chrome_bin="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" |
| 15 | + "$chrome_bin" "${pipeline_url}" 2>/dev/null |
| 16 | +} |
17 | 17 |
|
| 18 | +# Push and create GitHub PR, then wait for CI build to finish |
| 19 | +gpsp() ( |
| 20 | + set -euo pipefail |
| 21 | + _git_push_create_pr_and_open_pipeline "$@" |
18 | 22 | [ -f scripts/wait_for_ci_build ] && scripts/wait_for_ci_build |
19 | 23 | ) |
| 24 | + |
| 25 | +# Push, open PR, approve staging deploy, and wait for CI build to finish |
| 26 | +gpsps() ( |
| 27 | + set -euo pipefail |
| 28 | + _git_push_create_pr_and_open_pipeline "$@" |
| 29 | + ./scripts/ci/approve staging |
| 30 | + [ -f scripts/wait_for_ci_build ] && scripts/wait_for_ci_build |
| 31 | +) |
| 32 | + |
| 33 | +alias gpssp='gpsps' |
0 commit comments