Skip to content

Commit 5781a87

Browse files
committed
Switched 'test-org' to 'github-api-tests'
1 parent 09384e3 commit 5781a87

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lib/Repository.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,18 @@ class Repository extends Requestable {
504504
return this._request('POST', `/repos/${this.__fullname}/forks`, null, cb);
505505
}
506506

507+
/**
508+
* Fork a repository to an organization
509+
* @see https://developer.github.com/v3/repos/forks/#create-a-fork
510+
* @param {String} org - organization where you'd like to create the fork.
511+
* @param {Requestable.callback} cb - will receive the information about the newly created fork
512+
* @return {Promise} - the promise for the http request
513+
*
514+
*/
515+
forkToOrg(org, cb) {
516+
return this._request('POST', `/repos/${this.__fullname}/forks?organization=${org}`, null, cb);
517+
}
518+
507519
/**
508520
* List a repository's forks
509521
* @see https://developer.github.com/v3/repos/forks/#list-forks

test/repository.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ describe('Repository', function() {
112112
remoteRepo.fork(assertSuccessful(done));
113113
});
114114

115+
it('should fork repo to org', function(done) {
116+
remoteRepo.forkToOrg(testUser.ORGANIZATION, assertSuccessful(done));
117+
});
118+
115119
it('should list forks of repo', function(done) {
116120
remoteRepo.listForks(assertSuccessful(done, function(err, forks) {
117121
expect(forks).to.be.an.array();

0 commit comments

Comments
 (0)