Skip to content

Commit

Permalink
Merge pull request #87 from Smittey/task/upgrade-deprecated-methods
Browse files Browse the repository at this point in the history
Changing repo() function call to createRepo() due to deprecation warnings
  • Loading branch information
tbroadley authored Oct 26, 2019
2 parents d3b7079 + 60035de commit f56540f
Show file tree
Hide file tree
Showing 4 changed files with 1,971 additions and 206 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [7.1.2] - 2019-10-21
### Changed
- Upgraded to latest version of `@octokit/rest` due to deprecation warnings for the fork functionality [@smittey](https://github.com/smittey).

## [7.1.1] - 2018-10-19
### Fixed
- Attempt to connect to repository count is now accurate to the last retry [@adelsmee](https://github.com/adelsmee).
Expand Down
9 changes: 4 additions & 5 deletions lib/github.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const promisify = require('es6-promisify');
const GitHubApi = require('@octokit/rest');

const github = new GitHubApi();
let github;

function githubAuthenticate() {
github.authenticate({
type: 'token',
token: process.env.GITHUB_TOKEN,
github = new GitHubApi({
auth: process.env.GITHUB_TOKEN,
});
}

Expand Down Expand Up @@ -35,5 +34,5 @@ exports.deleteRepo = async (owner, repo) => {

exports.forkRepo = async (owner, repo) => {
githubAuthenticate();
return (await promisify(github.repos.fork)({ owner, repo })).data;
return (await promisify(github.repos.createFork)({ owner, repo })).data;
};
Loading

0 comments on commit f56540f

Please sign in to comment.