Skip to content

Commit 605a8a8

Browse files
committed
Replace request with fetch in ci-cleanup
1 parent 50544f3 commit 605a8a8

File tree

2 files changed

+13
-27
lines changed

2 files changed

+13
-27
lines changed

buildprocess/ci-cleanup.js

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
const childProcess = require("child_process");
22
const fs = require("fs");
3-
const request = require("request");
4-
5-
function requestPromise(options) {
6-
return new Promise((resolve, reject) => {
7-
request(options, (error, response, body) => {
8-
if (error) {
9-
reject(error);
10-
} else {
11-
resolve(response);
12-
}
13-
});
14-
});
15-
}
163

174
function getAllBranches(repo) {
185
const baseUrl = "https://api.github.com/repos/" + repo + "/branches";
@@ -24,24 +11,24 @@ function getAllBranches(repo) {
2411
++page;
2512

2613
let url = baseUrl + "?page=" + page;
27-
return requestPromise({
28-
url: url,
14+
return fetch(url, {
2915
headers: {
3016
"User-Agent": "TerriaJS CI",
3117
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`
3218
}
33-
}).then((pageResponse) => {
34-
const pageOfBranches = JSON.parse(pageResponse.body);
35-
result.push(
36-
...pageOfBranches.filter(
37-
(branch) => branch.name.indexOf("greenkeeper/") !== 0
38-
)
39-
);
19+
})
20+
.then((response) => response.json())
21+
.then((pageOfBranches) => {
22+
result.push(
23+
...pageOfBranches.filter(
24+
(branch) => branch.name.indexOf("greenkeeper/") !== 0
25+
)
26+
);
4027

41-
if (pageOfBranches.length > 0) {
42-
return getNextPage();
43-
}
44-
});
28+
if (pageOfBranches.length > 0) {
29+
return getNextPage();
30+
}
31+
});
4532
}
4633

4734
return getNextPage().then(() => result);

buildprocess/ci-deploy.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ gh api /repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA} -f state=pending -f co
1919
# Install some tools we need from npm
2020
npm install -g https://github.com/terriajs/sync-dependencies
2121
npm install -g yarn@^1.19.0
22-
yarn add -W [email protected]
2322

2423
# Clone and build TerriaMap, using this version of TerriaJS
2524
TERRIAJS_COMMIT_HASH=$(git rev-parse HEAD)

0 commit comments

Comments
 (0)