File: merge_pr.sh

package info (click to toggle)
python-py-ecc 8.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 796 kB
  • sloc: python: 4,896; makefile: 237
file content (12 lines) | stat: -rwxr-xr-x 599 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash

if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
  PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
  PR_BASE_BRANCH=$(curl -L "$PR_INFO_URL" | python -c 'import json, sys; obj = json.load(sys.stdin); sys.stdout.write(obj["base"]["ref"])')
  git fetch origin +"$PR_BASE_BRANCH":circleci/pr-base
  # We need these config values or git complains when creating the
  # merge commit
  git config --global user.name "Circle CI"
  git config --global user.email "circleci@example.com"
  git merge --no-edit circleci/pr-base
fi