Skip to content

Commit

Permalink
Merge pull request #1 from adamzolyak/refactorAuth
Browse files Browse the repository at this point in the history
Update Octokit to use new auth method
  • Loading branch information
adamzolyak authored Feb 21, 2019
2 parents ed4948b + 50d620f commit d999b30
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 40 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Test Status: [![CircleCI](https://circleci.com/gh/adamzolyak/issue-labeler-actio
```bash
export GITHUB_TOKEN="12345"
export GITHUB_REPOSITORY="adamzolyak/actions-playground"
export GITHUB_EVENT_PATH="/tests/fixtures/actionTrigger.json"
export GITHUB_EVENT_PATH="/issue-labeler-action/tests/fixtures/actionTrigger.json"

node index.js
```
Expand Down
9 changes: 3 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ const helpers = require('./helpers')

//require octokit rest.js
//more info at https://github.com/octokit/rest.js
const octokit = require('@octokit/rest')()

//set octokit auth to action's GITHUB_TOKEN env variable
octokit.authenticate({
type: 'app',
token: process.env.GITHUB_TOKEN
const Octokit = require('@octokit/rest')
const octokit = new Octokit({
auth: `token ${process.env.GITHUB_TOKEN}`
})

//set eventOwner and eventRepo based on action's env variables
Expand Down
2 changes: 1 addition & 1 deletion dev.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

export GITHUB_TOKEN="12345"
export GITHUB_REPOSITORY="adamzolyak/actions-playground"
export GITHUB_EVENT_PATH="/action-checklistchecker/tests/fixtures/actionTrigger.json"
export GITHUB_EVENT_PATH="/issue-labeler-action/tests/fixtures/actionTrigger.json"

node index.js
56 changes: 25 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"homepage": "https://www.tinkurlab.com",
"dependencies": {
"@octokit/rest": "^16.2.0"
"@octokit/rest": "^16.16.0"
},
"devDependencies": {
"jest": "^23.6.0"
Expand Down

0 comments on commit d999b30

Please sign in to comment.