diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..09827eb1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at . All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/lib/Repository.js b/lib/Repository.js index daf9443f..74452dde 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -198,6 +198,23 @@ class Repository extends Requestable { return this._request('GET', `/repos/${this.__fullname}/commits`, options, cb); } + /** + * List the commits on a pull request + * @see https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository + * @param {number|string} number - the number of the pull request to list the commits + * @param {Object} [options] - the filtering options for commits + * @param {Requestable.callback} [cb] - will receive the commits information + * @return {Promise} - the promise for the http request + */ + listCommitsOnPR(number, options, cb) { + options = options || {}; + if (typeof options === 'function') { + cb = options; + options = {}; + } + return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/commits`, options, cb); + } + /** * Gets a single commit information for a repository * @see https://developer.github.com/v3/repos/commits/#get-a-single-commit diff --git a/lib/User.js b/lib/User.js index d6470324..a6f22324 100644 --- a/lib/User.js +++ b/lib/User.js @@ -92,8 +92,8 @@ class User extends Requestable { } /** - * List users followed by another user - * @see https://developer.github.com/v3/users/followers/#list-users-followed-by-another-user + * Lists the people who the authenticated user follows. + * @see https://docs.github.com/en/rest/reference/users#list-the-people-the-authenticated-user-follows * @param {Requestable.callback} [cb] - will receive the list of who a user is following * @return {Promise} - the promise for the http request */ diff --git a/package.json b/package.json index b3c78db3..8e54341a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-api", - "version": "3.3.0", + "version": "3.4.0", "license": "BSD-3-Clause-Clear", "description": "A higher-level wrapper around the Github API.", "main": "dist/components/GitHub.js", @@ -52,7 +52,7 @@ "dist/*" ], "dependencies": { - "axios": "^0.19.0", + "axios": "^0.21.1", "debug": "^2.2.0", "js-base64": "^2.1.9", "utf8": "^2.1.1" diff --git a/test/auth.spec.js b/test/auth.spec.js index d1aea684..00842ee9 100644 --- a/test/auth.spec.js +++ b/test/auth.spec.js @@ -84,7 +84,7 @@ describe('Github', function() { it('should fail authentication and return err', function(done) { user.listNotifications(assertFailure(done, function(err) { expect(err.response.status).to.be.equal(401, 'Return 401 status for bad auth'); - expect(err.response.data.message).to.equal('Bad credentials'); + expect(err.response.data.message).to.equal('Requires authentication'); done(); })); diff --git a/test/markdown.spec.js b/test/markdown.spec.js index bd9e7c37..909581fa 100644 --- a/test/markdown.spec.js +++ b/test/markdown.spec.js @@ -37,7 +37,7 @@ describe('Markdown', function() { }; markdown.render(options) .then(function({data: html}) { - expect(html).to.be('
Hello world github/linguist#1 cool, and gollum#1!
'); // eslint-disable-line + expect(html).to.be('Hello world github/linguist#1 cool, and gollum#1!
'); // eslint-disable-line done(); }).catch(done); }); diff --git a/test/repository.spec.js b/test/repository.spec.js index 7102874b..f27cc788 100644 --- a/test/repository.spec.js +++ b/test/repository.spec.js @@ -173,6 +173,24 @@ describe('Repository', function() { })); }); + it('should list commits on a PR with no options', function(done) { + const PR_NUMBER = 588; + remoteRepo.listCommitsOnPR(PR_NUMBER, assertSuccessful(done, function(err, commits) { + expect(commits).to.be.an.array(); + expect(commits.length).to.be.equal(2); + + let message1 = 'fix(repository): prevents lib from crashing when not providing optional arguments'; + expect(commits[0].author).to.have.own('login', 'hazmah0'); + expect(commits[0].commit).to.have.own('message', message1); + + let message2 = 'test(repository): updates test to use promise instead of callback'; + expect(commits[1].author).to.have.own('login', 'hazmah0'); + expect(commits[1].commit).to.have.own('message', message2); + + done(); + })); + }); + it('should get the latest commit from master', function(done) { remoteRepo.getSingleCommit('master', assertSuccessful(done, function(err, commit) { expect(commit).to.have.own('sha'); @@ -392,7 +410,7 @@ describe('Repository', function() { expect(fileText).to.be(initialText); done(); - }))) + }))); }); it('should rename files', function(done) {