Skip to content
This repository was archived by the owner on Jul 14, 2020. It is now read-only.
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: node:8@sha256:5aebe186c00da3308c8fde5b3a246d1927a56947a1b51f5c4308b7318adf74f4
- image: node:8@sha256:a8a9d8eaab36bbd188612375a54fb7f57418458812dabd50769ddd3598bc24fc

steps:
- checkout:
Expand Down
1 change: 0 additions & 1 deletion __mocks__/@octokit/rest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = jest.fn().mockImplementation(() => {
return {
authenticate: jest.fn(),
search: {
issues: jest.fn()
}
Expand Down
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module.exports = {
'package.json': ['fixpack', 'git add'],
'*.config.js': ['prettier --write', 'git add'],
'*.json': ['prettier --write', 'git add'],
'*.ts': ['prettier --write', 'npm run lint', 'git add']
'*.ts': ['prettier --write', 'git add']
};
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@
"author": "Jeff Fairley",
"bugs": "https://github.com/jfairley/github-slack-bot/issues",
"dependencies": {
"@octokit/rest": "16.8.1",
"@octokit/rest": "16.15.0",
"@octokit/webhooks": "5.1.2",
"bluebird": "3.5.1",
"botkit": "0.6.14",
"botkit": "0.7.2",
"lodash": "4.17.10",
"moment": "2.22.2",
"ts-node": "8.0.2"
},
"devDependencies": {
"@commitlint/cli": "7.2.1",
"@commitlint/config-conventional": "7.1.2",
"@commitlint/prompt-cli": "7.2.1",
"@commitlint/cli": "7.5.2",
"@commitlint/config-conventional": "7.5.0",
"@commitlint/prompt-cli": "7.5.0",
"@octokit/webhooks-definitions": "1.1.2",
"@types/bluebird": "3.5.20",
"@types/jest": "23.3.12",
"@types/jest": "24.0.5",
"@types/lodash": "4.14.110",
"fixpack": "2.3.1",
"husky": "1.3.1",
"jest": "23.6.0",
"jest-junit": "6.0.1",
"jest": "24.1.0",
"jest-junit": "6.3.0",
"lint-staged": "8.0.4",
"prettier": "1.16.1",
"semantic-release": "15.6.0",
"ts-jest": "23.10.5",
"tslint": "5.12.1",
"tslint-config-prettier": "1.17.0",
"typescript": "3.2.2"
"typescript": "3.3.3"
},
"homepage": "https://github.com/jfairley/github-slack-bot#readme",
"keywords": [
Expand Down
6 changes: 2 additions & 4 deletions src/listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ export const messenger = controller => {
});

// github api
const github = new Github();
github.authenticate({
type: 'token',
token: GITHUB_TOKEN
const github = new Github({
auth: `token ${GITHUB_TOKEN}`
});

http.createServer(webhooksApi.middleware).listen(GITHUB_WEBHOOK_PORT);
Expand Down
6 changes: 2 additions & 4 deletions src/pulls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ if (!process.env.GITHUB_TOKEN) {
process.exit(1);
}

const github = new Github();
github.authenticate({
type: 'token',
token: process.env.GITHUB_TOKEN
const github = new Github({
auth: `token ${process.env.GITHUB_TOKEN}`
});

export const commands = [
Expand Down
6 changes: 2 additions & 4 deletions test/listener.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ describe('listener', () => {

it('should configure github rest API', () => {
expect(Github).toHaveBeenCalledTimes(1);
expect(getGithub().authenticate).toHaveBeenCalledTimes(1);
expect(getGithub().authenticate).toHaveBeenCalledWith({
type: 'token',
token: 'test-github-token'
expect(Github).toHaveBeenCalledWith({
auth: 'token test-github-token'
});
});

Expand Down