summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2018-07-05 16:28:14 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2018-07-13 12:26:40 -0700
commitbea8f8d177905bfb74e8b5c2d5e7750b3d6bad8e (patch)
tree2609c5e72288ea5777a644a746c50539b57c07c6 /scripts
parent63d6bca609be80e12ff797f22d46681b439ac5ab (diff)
downloadqtlocation-mapboxgl-bea8f8d177905bfb74e8b5c2d5e7750b3d6bad8e.tar.gz
[build] Use CIRCLE_MERGE_BASE environment variable
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check_binary_size.js27
1 files changed, 5 insertions, 22 deletions
diff --git a/scripts/check_binary_size.js b/scripts/check_binary_size.js
index 2b86436f92..a12939c2af 100755
--- a/scripts/check_binary_size.js
+++ b/scripts/check_binary_size.js
@@ -4,7 +4,6 @@ const jwt = require('jsonwebtoken');
const github = require('@octokit/rest')();
const prettyBytes = require('pretty-bytes');
const fs = require('fs');
-const {execSync} = require('child_process');
const SIZE_CHECK_APP_ID = 14028;
const SIZE_CHECK_APP_INSTALLATION_ID = 229425;
@@ -30,32 +29,16 @@ const token = jwt.sign(payload, key, {algorithm: 'RS256'});
github.authenticate({type: 'app', token});
function getPriorSize() {
- const pr = process.env['CIRCLE_PULL_REQUEST'];
- if (!pr) {
- console.log('No pull request available.');
+ const mergeBase = process.env['CIRCLE_MERGE_BASE'];
+ if (!mergeBase) {
+ console.log('No merge base available.');
return Promise.resolve(null);
}
- const number = +pr.match(/\/(\d+)\/?$/)[1];
- console.log(`Pull request ${number}.`);
-
- return github.pullRequests.get({
+ return github.checks.listForRef({
owner: 'mapbox',
repo: 'mapbox-gl-native',
- number
- }).then(({data}) => {
- const head = process.env['CIRCLE_SHA1'];
- const base = data.base.sha;
- console.log(`Pull request target is ${base}.`);
-
- const mergeBase = execSync(`git merge-base ${base} ${head}`).toString().trim();
- console.log(`Merge base is ${mergeBase}.`);
-
- return github.checks.listForRef({
- owner: 'mapbox',
- repo: 'mapbox-gl-native',
- ref: mergeBase
- });
+ ref: mergeBase
}).then(({data}) => {
const run = data.check_runs.find(run => run.name === name);
if (!run) {