Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/GitHub.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const GitHubApi = require('github')
//const GitHubApi = require('github')
const GitHubApi = require('@octokit/rest') // keeping const "GitHubApi" for context

const GITHUB_CONNECT = 1

Expand Down
20 changes: 10 additions & 10 deletions lib/SpeedTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ SpeedTracker.prototype._getPagespeedScore = function (url) {
}

SpeedTracker.prototype._getRemoteFile = function (file) {
return this.options.remote.api.repos.getContent({
user: this.options.user,
return this.options.remote.api.repos.getContents({
owner: this.options.user,
repo: this.options.repo,
path: file,
ref: this.options.branch
}).then(response => {
var content = new Buffer(response.content, 'base64').toString()
var content = new Buffer.from(response.data.content, 'base64').toString()

return {
content,
sha: response.sha
sha: response.data.sha
}
})
}
Expand Down Expand Up @@ -219,14 +219,14 @@ SpeedTracker.prototype._saveTest = function (profile, content, isScheduled) {

// Append results
Utils.mergeObject(payload._r, content, payload._ts.length)

return this.options.remote.api.repos.updateFile({
user: this.options.user,
owner: this.options.user,
repo: this.options.repo,
branch: this.options.branch,
path: path,
sha: data.sha,
content: new Buffer(JSON.stringify(payload)).toString('base64'),
content: new Buffer.from(JSON.stringify(payload)).toString('base64'),
message: message
})
} catch (err) {
Expand All @@ -243,15 +243,15 @@ SpeedTracker.prototype._saveTest = function (profile, content, isScheduled) {
Utils.mergeObject(payload._r, content)

return this.options.remote.api.repos.createFile({
user: this.options.user,
owner: this.options.user,
repo: this.options.repo,
branch: this.options.branch,
path: path,
content: new Buffer(JSON.stringify(payload)).toString('base64'),
content: new Buffer.from(JSON.stringify(payload)).toString('base64'),
message: message
})
} else {
return Promise.reject(Utils.buildError('CORRUPT_RESULT_FILE'))
return Promise.reject(Utils.buildError('CORRUPT_RESULT_FILE_ERR2'))
}
})
}
Expand Down
Loading