Skip to content

Commit c18b0ce

Browse files
authored
Merge pull request ethereum#3 from carver/circle-merge
circleci: merge (and reattempt) PR before testing
2 parents 1f89c63 + 8815766 commit c18b0ce

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

.circleci/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ common: &common
66
working_directory: ~/repo
77
steps:
88
- checkout
9+
- run:
10+
name: merge pull request base
11+
command: ./.circleci/merge_pr.sh
12+
- run:
13+
name: merge pull request base (2nd try)
14+
command: ./.circleci/merge_pr.sh
15+
when: on_fail
16+
- run:
17+
name: merge pull request base (3nd try)
18+
command: ./.circleci/merge_pr.sh
19+
when: on_fail
920
- run:
1021
name: merge pull request base
1122
command: |
@@ -33,6 +44,7 @@ common: &common
3344
command: ~/.local/bin/tox -r
3445
- save_cache:
3546
paths:
47+
- .hypothesis
3648
- .tox
3749
- ~/.cache/pip
3850
- ~/.local

.circleci/merge_pr.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
4+
PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
5+
PR_BASE_BRANCH=$(curl -L "$PR_INFO_URL" | python -c 'import json, sys; obj = json.load(sys.stdin); sys.stdout.write(obj["base"]["ref"])')
6+
git fetch origin +"$PR_BASE_BRANCH":circleci/pr-base
7+
# We need these config values or git complains when creating the
8+
# merge commit
9+
git config --global user.name "Circle CI"
10+
git config --global user.email "circleci@example.com"
11+
git merge --no-edit circleci/pr-base
12+
fi

0 commit comments

Comments
 (0)