1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Manual tool to go with soil/maybe-merge.sh.
|
4 | #
|
5 | # Usage:
|
6 | # devtools/github.sh <function name>
|
7 |
|
8 | set -o nounset
|
9 | set -o pipefail
|
10 | set -o errexit
|
11 |
|
12 | # A github commit status that's required for the master branch.
|
13 | # This is a reminder to change PR targets to soil-staging, NOT master.
|
14 |
|
15 | # SETUP:
|
16 | # github.com/oilshell/oil
|
17 | # -> Settings tab
|
18 | # -> Branches on LHS
|
19 | # -> Add Branch Protection Rule 'master'
|
20 | # -> Require Status Checks To Pass Before Merging
|
21 | # -> soil/allow-emergency-push-to-master
|
22 |
|
23 | allow-emergency-push-to-master() {
|
24 |
|
25 | local commit_hash=${1:-0187d24d84a1f14a96eeb3a57bf7920787082ea9}
|
26 | local github_token
|
27 | github_token=$(cat token.txt)
|
28 |
|
29 | curl \
|
30 | -X POST \
|
31 | -H "Accept: application/vnd.github+json" \
|
32 | -H "Authorization: token $github_token" \
|
33 | "https://api.github.com/repos/oilshell/oil/statuses/$commit_hash" \
|
34 | -d '
|
35 | { "state": "success",
|
36 | "target_url": "https://travis-ci.oilshell.org",
|
37 | "description": "Usually you should merge to soil-staging, NOT master",
|
38 | "context": "soil/allow-emergency-push-to-master"
|
39 | }'
|
40 |
|
41 | }
|
42 |
|
43 | "$@"
|