From c705ab61a731121d154cfd2ac1e6e5f17658fec0 Mon Sep 17 00:00:00 2001 From: Phillip Johnsen Date: Tue, 12 Jun 2018 09:18:15 +0200 Subject: [PATCH 1/3] travis: delete Travis polling code in favor of Travis CI GitHub app We have recently found that we can enable Travis CI per repo with the Travis CI GitHub app, rather than the old GitHub Service that required organization wide private access, which the nodejs organization didn't want to provide. Since using the GitHub app per repo instead, there is no need for this bot to do any Travis CI polling anymore -- hoooray! --- README.md | 7 - lib/pollTravis.js | 124 ------ package.json | 3 +- scripts/display-travis-status.js | 62 --- test/_fixtures/github-pr-payload.json | 445 -------------------- test/_fixtures/pr-commits-for-travis.json | 154 ------- test/_fixtures/travis-build-created.json | 75 ---- test/_fixtures/travis-build-failed.json | 75 ---- test/_fixtures/travis-build-no-commits.json | 47 --- test/_fixtures/travis-build-passed.json | 75 ---- test/integration/poll-travis-status.test.js | 156 ------- test/unit/display-travis-status.test.js | 101 ----- 12 files changed, 1 insertion(+), 1323 deletions(-) delete mode 100644 lib/pollTravis.js delete mode 100644 scripts/display-travis-status.js delete mode 100644 test/_fixtures/github-pr-payload.json delete mode 100644 test/_fixtures/pr-commits-for-travis.json delete mode 100644 test/_fixtures/travis-build-created.json delete mode 100644 test/_fixtures/travis-build-failed.json delete mode 100644 test/_fixtures/travis-build-no-commits.json delete mode 100644 test/_fixtures/travis-build-passed.json delete mode 100644 test/integration/poll-travis-status.test.js delete mode 100644 test/unit/display-travis-status.test.js diff --git a/README.md b/README.md index 2a3bc2a2..d811b4c6 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). The [GitHub API token](https://github.com/blog/1509-personal-api-tokens) for your account (or bot account) that will be used to make API calls to GitHub. The account must have proper access to perform the actions required by your script. - **`GITHUB_WEBHOOK_SECRET`**
The webhook secret that GitHub signs the POSTed payloads with. This is created when the webhook is defined. The default is `hush-hush`. -- **`TRAVIS_CI_TOKEN`**
- For scripts that communicate with Travis CI. Your Travis token is visible on [yourprofile](https://travis-ci.org/profile) page, by clicking the "show token" link. Also See: https://blog.travis-ci.com/2013-01-28-token-token-token -- **`TRAVIS_POLL_RETRY`**
- Default number of retries that the bot should attempt to poll for the Travis build status. -- **`TRAVIS_POLL_INTERVAL`**
- Default interval that the bot should use to poll for the Travis build status. - **`JENKINS_WORKER_IPS`**
List of valid Jenkins worker IPs allowed to push PR status updates, split by comma: `192.168.1.100,192.168.1.101`. - **`JENKINS_API_CREDENTIALS`** (optional)
@@ -48,7 +42,6 @@ The bot will try to load a `.env` file at the root of the project if it exists t ``` GITHUB_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -TRAVIS_CI_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx SSE_RELAY=https://hook-relay.herokuapp.com ``` diff --git a/lib/pollTravis.js b/lib/pollTravis.js deleted file mode 100644 index ab059c51..00000000 --- a/lib/pollTravis.js +++ /dev/null @@ -1,124 +0,0 @@ -'use strict' - -const Travis = require('travis-ci') - -const githubClient = require('./github-client') - -const travisClient = new Travis({ - version: '2.0.0', - access_token: process.env.TRAVIS_CI_TOKEN -}) - -exports.pollThenStatus = pollByCommitThenStatus - -/** - * Poll and match builds by the last commit SHA of the related PR. - */ -function pollByCommitThenStatus (options) { - githubClient.pullRequests.getCommits({ - owner: options.owner, - repo: options.repo, - number: options.pr - }, (err, commitMetas) => { - if (err) { - return options.logger.error(err, 'Got error when retrieving GitHub commits for PR') - } - - const lastCommitMeta = commitMetas.pop() - const lastCommit = { - sha: lastCommitMeta.sha, - date: lastCommitMeta.commit.committer.date - } - - const optsWithCommit = Object.assign({ lastCommit }, options) - - // attach last commit sha to all subsequent logs - optsWithCommit.logger = options.logger.child({ - commit: lastCommit.sha, - retry: options.retry, - interval: options.interval - }, true) - - pollTravisBuildBySha(optsWithCommit) - optsWithCommit.logger.info('Started polling Travis for build by commit') - }) -} - -function pollTravisBuildBySha (options, checkNumber = 1) { - const createGhStatus = createGhStatusFn(options) - const toMatch = { - sha: options.lastCommit.sha, - date: options.lastCommit.date, - pr: options.pr - } - - if (checkNumber > options.retry) { - options.logger.warn('Was not able to find matching build for PR, stopping poll now :(') - return - } - - travisClient.repos(options.owner, options.repo).builds.get((err, res) => { - if (err) { - return options.logger.error(err, 'Got error when retrieving Travis builds') - } - - const matchingCommit = res.commits.find((commit) => { - const matchesShaOrPr = commit.sha === toMatch.sha || commit.pull_request_number === toMatch.pr - const matchesCommitDate = commit.committed_at === toMatch.date - - return matchesCommitDate && matchesShaOrPr - }) - - const interval = options.interval - if (!matchingCommit) { - options.logger.warn(`Travis hasn't picked up last commit yet, will do check #${checkNumber + 1} in ${interval} seconds`) - return setTimeout(pollTravisBuildBySha, interval * 1000, options, checkNumber + 1) - } - - const lastBuildForCommit = res.builds.find((build) => build.commit_id === matchingCommit.id) - if (lastBuildForCommit) { - const lastState = lastBuildForCommit.state - - if (lastState === 'passed') { - return createGhStatus('success', lastBuildForCommit.id, 'all tests passed') - } else if (lastState === 'failed') { - return createGhStatus('failure', lastBuildForCommit.id, 'build failure') - } else if (lastState === 'errored') { - return createGhStatus('error', lastBuildForCommit.id, 'build errored') - } else if (lastState === 'canceled') { - return createGhStatus('error', lastBuildForCommit.id, 'build canceled') - } else if (~['created', 'started'].indexOf(lastState)) { - options.logger.info(`"${lastState}" build found, will do check #${checkNumber + 1} in ${interval} seconds`) - createGhStatus('pending', lastBuildForCommit.id, 'build in progress') - } else { - return options.logger.info(`Unknown build state: "${lastState}", stopping polling`) - } - } else { - options.logger.warn(`Was not able to find matching build by last commit, will do check #${checkNumber + 1} in ${interval} seconds`) - } - - setTimeout(pollTravisBuildBySha, interval * 1000, options, checkNumber + 1) - }) -} - -function createGhStatusFn (options) { - return (state, travisId, message) => { - const status = { - owner: options.owner, - repo: options.repo, - sha: options.lastCommit.sha, - target_url: `https://travis-ci.org/${options.owner}/${options.repo}/builds/${travisId}`, - context: 'Travis CI via nodejs-github-bot', - state: state, - description: message - } - - const logger = options.logger.child({ state, travisId, message }, true) - githubClient.repos.createStatus(status, (err, res) => { - if (err) { - return logger.error(err, 'Error while updating GitHub PR status') - } - logger.info('Github PR status updated') - }) - } -} diff --git a/package.json b/package.json index 9414f4c2..88f69e57 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,7 @@ "express": "^4.13.4", "github": "^7.0.1", "glob": "^7.0.3", - "lru-cache": "^4.0.1", - "travis-ci": "^2.1.0" + "lru-cache": "^4.0.1" }, "devDependencies": { "eventsource": "^0.2.1", diff --git a/scripts/display-travis-status.js b/scripts/display-travis-status.js deleted file mode 100644 index 5a8bd244..00000000 --- a/scripts/display-travis-status.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict' - -const debug = require('debug')('display_travis_status') -const pollTravis = require('../lib/pollTravis') - -// Default is 20 retries, 30 seconds per retry, which is reasonable for -// smaller projects that finish testing within 10 minutes. -const DEFAULT_POLL_RETRY = process.env.TRAVIS_POLL_RETRY || 20 -const DEFAULT_POLL_INTERVAL = process.env.TRAVIS_POLL_INTERVAL || 30 - -// For projects that take longer to build e.g. projects that actually use -// Travis to build, increase the interval so there will be fewer useless -// polls -const enabledRepos = { - 'citgm': { retry: 40 }, - 'readable-stream': { retry: 60, interval: 60 }, - 'string_decoder': { retry: 60, interval: 60 }, - 'nodejs.org': { }, - 'docker-node': { retry: 70, interval: 120 }, - 'llnode': { retry: 60, interval: 60 }, - 'nan': { retry: 60, interval: 60 }, - 'node-core-utils': { }, - 'core-validate-commit': { }, - 'i18n': { } -} - -module.exports = function (app) { - app.on('pull_request.opened', handlePrUpdate) - // Pull Request updates - app.on('pull_request.synchronize', handlePrUpdate) - - function handlePrUpdate (event, owner, repo) { - const config = enabledRepos[repo] - if (!config) return - - const pr = event.number - const retry = config.retry || DEFAULT_POLL_RETRY - const interval = config.interval || DEFAULT_POLL_INTERVAL - const options = { owner, repo, pr, retry, interval, logger: event.logger } - - debug(`/${owner}/${repo}/pull/${pr} opened`) - pollTravis.pollThenStatus(options) - } - - // to trigger polling manually - app.get('/pr/:owner/:repo/:id', (req, res) => { - const owner = req.params.owner - const repo = req.params.repo - const pr = parseInt(req.params.id, 10) - const config = enabledRepos[repo] - if (config) { - const retry = config.retry || DEFAULT_POLL_RETRY - const interval = config.interval || DEFAULT_POLL_INTERVAL - const options = { owner, repo, pr, retry, interval, logger: req.log } - res.writeHead(201) - pollTravis.pollThenStatus(options) - } else { - res.writeHead(404, 'Repo not enabled') - } - res.end() - }) -} diff --git a/test/_fixtures/github-pr-payload.json b/test/_fixtures/github-pr-payload.json deleted file mode 100644 index e702fb85..00000000 --- a/test/_fixtures/github-pr-payload.json +++ /dev/null @@ -1,445 +0,0 @@ -{ - "action": "synchronize", - "number": 100, - "pull_request": { - "url": "https://api.github.com/repos/nodejs/node-core-utils/pulls/100", - "id": 151830954, - "html_url": "https://github.com/nodejs/node-core-utils/pull/100", - "diff_url": "https://github.com/nodejs/node-core-utils/pull/100.diff", - "patch_url": "https://github.com/nodejs/node-core-utils/pull/100.patch", - "issue_url": "https://api.github.com/repos/nodejs/node-core-utils/issues/100", - "number": 100, - "state": "open", - "locked": false, - "title": "Testing github intergrations", - "user": { - "login": "joyeecheung", - "id": 4299420, - "avatar_url": "https://avatars0.githubusercontent.com/u/4299420?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/joyeecheung", - "html_url": "https://github.com/joyeecheung", - "followers_url": "https://api.github.com/users/joyeecheung/followers", - "following_url": "https://api.github.com/users/joyeecheung/following{/other_user}", - "gists_url": "https://api.github.com/users/joyeecheung/gists{/gist_id}", - "starred_url": "https://api.github.com/users/joyeecheung/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/joyeecheung/subscriptions", - "organizations_url": "https://api.github.com/users/joyeecheung/orgs", - "repos_url": "https://api.github.com/users/joyeecheung/repos", - "events_url": "https://api.github.com/users/joyeecheung/events{/privacy}", - "received_events_url": "https://api.github.com/users/joyeecheung/received_events", - "type": "User", - "site_admin": false - }, - "body": "This PR is for testing how we can bring the CI integrations back without granting third-party access to those services..", - "created_at": "2017-11-10T05:48:12Z", - "updated_at": "2017-11-16T11:03:51Z", - "closed_at": null, - "merged_at": null, - "merge_commit_sha": "9fb26b7ba00f7657e06845663ba98e74a2c54b78", - "assignee": null, - "assignees": [ - - ], - "requested_reviewers": [ - - ], - "milestone": null, - "commits_url": "https://api.github.com/repos/nodejs/node-core-utils/pulls/100/commits", - "review_comments_url": "https://api.github.com/repos/nodejs/node-core-utils/pulls/100/comments", - "review_comment_url": "https://api.github.com/repos/nodejs/node-core-utils/pulls/comments{/number}", - "comments_url": "https://api.github.com/repos/nodejs/node-core-utils/issues/100/comments", - "statuses_url": "https://api.github.com/repos/nodejs/node-core-utils/statuses/eb1c004a4dfaea361eec5b8f654ed91ea28342cb", - "head": { - "label": "joyeecheung:test-intergration", - "ref": "test-intergration", - "sha": "eb1c004a4dfaea361eec5b8f654ed91ea28342cb", - "user": { - "login": "joyeecheung", - "id": 4299420, - "avatar_url": "https://avatars0.githubusercontent.com/u/4299420?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/joyeecheung", - "html_url": "https://github.com/joyeecheung", - "followers_url": "https://api.github.com/users/joyeecheung/followers", - "following_url": "https://api.github.com/users/joyeecheung/following{/other_user}", - "gists_url": "https://api.github.com/users/joyeecheung/gists{/gist_id}", - "starred_url": "https://api.github.com/users/joyeecheung/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/joyeecheung/subscriptions", - "organizations_url": "https://api.github.com/users/joyeecheung/orgs", - "repos_url": "https://api.github.com/users/joyeecheung/repos", - "events_url": "https://api.github.com/users/joyeecheung/events{/privacy}", - "received_events_url": "https://api.github.com/users/joyeecheung/received_events", - "type": "User", - "site_admin": false - }, - "repo": { - "id": 110206108, - "name": "node-core-utils", - "full_name": "joyeecheung/node-core-utils", - "owner": { - "login": "joyeecheung", - "id": 4299420, - "avatar_url": "https://avatars0.githubusercontent.com/u/4299420?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/joyeecheung", - "html_url": "https://github.com/joyeecheung", - "followers_url": "https://api.github.com/users/joyeecheung/followers", - "following_url": "https://api.github.com/users/joyeecheung/following{/other_user}", - "gists_url": "https://api.github.com/users/joyeecheung/gists{/gist_id}", - "starred_url": "https://api.github.com/users/joyeecheung/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/joyeecheung/subscriptions", - "organizations_url": "https://api.github.com/users/joyeecheung/orgs", - "repos_url": "https://api.github.com/users/joyeecheung/repos", - "events_url": "https://api.github.com/users/joyeecheung/events{/privacy}", - "received_events_url": "https://api.github.com/users/joyeecheung/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/joyeecheung/node-core-utils", - "description": "CLI tools for Node.js Core collaborators", - "fork": true, - "url": "https://api.github.com/repos/joyeecheung/node-core-utils", - "forks_url": "https://api.github.com/repos/joyeecheung/node-core-utils/forks", - "keys_url": "https://api.github.com/repos/joyeecheung/node-core-utils/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/joyeecheung/node-core-utils/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/joyeecheung/node-core-utils/teams", - "hooks_url": "https://api.github.com/repos/joyeecheung/node-core-utils/hooks", - "issue_events_url": "https://api.github.com/repos/joyeecheung/node-core-utils/issues/events{/number}", - "events_url": "https://api.github.com/repos/joyeecheung/node-core-utils/events", - "assignees_url": "https://api.github.com/repos/joyeecheung/node-core-utils/assignees{/user}", - "branches_url": "https://api.github.com/repos/joyeecheung/node-core-utils/branches{/branch}", - "tags_url": "https://api.github.com/repos/joyeecheung/node-core-utils/tags", - "blobs_url": "https://api.github.com/repos/joyeecheung/node-core-utils/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/joyeecheung/node-core-utils/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/joyeecheung/node-core-utils/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/joyeecheung/node-core-utils/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/joyeecheung/node-core-utils/statuses/{sha}", - "languages_url": "https://api.github.com/repos/joyeecheung/node-core-utils/languages", - "stargazers_url": "https://api.github.com/repos/joyeecheung/node-core-utils/stargazers", - "contributors_url": "https://api.github.com/repos/joyeecheung/node-core-utils/contributors", - "subscribers_url": "https://api.github.com/repos/joyeecheung/node-core-utils/subscribers", - "subscription_url": "https://api.github.com/repos/joyeecheung/node-core-utils/subscription", - "commits_url": "https://api.github.com/repos/joyeecheung/node-core-utils/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/joyeecheung/node-core-utils/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/joyeecheung/node-core-utils/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/joyeecheung/node-core-utils/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/joyeecheung/node-core-utils/contents/{+path}", - "compare_url": "https://api.github.com/repos/joyeecheung/node-core-utils/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/joyeecheung/node-core-utils/merges", - "archive_url": "https://api.github.com/repos/joyeecheung/node-core-utils/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/joyeecheung/node-core-utils/downloads", - "issues_url": "https://api.github.com/repos/joyeecheung/node-core-utils/issues{/number}", - "pulls_url": "https://api.github.com/repos/joyeecheung/node-core-utils/pulls{/number}", - "milestones_url": "https://api.github.com/repos/joyeecheung/node-core-utils/milestones{/number}", - "notifications_url": "https://api.github.com/repos/joyeecheung/node-core-utils/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/joyeecheung/node-core-utils/labels{/name}", - "releases_url": "https://api.github.com/repos/joyeecheung/node-core-utils/releases{/id}", - "deployments_url": "https://api.github.com/repos/joyeecheung/node-core-utils/deployments", - "created_at": "2017-11-10T05:20:15Z", - "updated_at": "2017-11-10T05:20:17Z", - "pushed_at": "2017-11-16T11:03:51Z", - "git_url": "git://github.com/joyeecheung/node-core-utils.git", - "ssh_url": "git@github.com:joyeecheung/node-core-utils.git", - "clone_url": "https://github.com/joyeecheung/node-core-utils.git", - "svn_url": "https://github.com/joyeecheung/node-core-utils", - "homepage": "", - "size": 244, - "stargazers_count": 0, - "watchers_count": 0, - "language": "JavaScript", - "has_issues": false, - "has_projects": true, - "has_downloads": true, - "has_wiki": true, - "has_pages": false, - "forks_count": 0, - "mirror_url": null, - "archived": false, - "open_issues_count": 1, - "forks": 0, - "open_issues": 1, - "watchers": 0, - "default_branch": "master" - } - }, - "base": { - "label": "nodejs:master", - "ref": "master", - "sha": "5c42f35e1367f85e2eca7e24cf7c747955ca8235", - "user": { - "login": "nodejs", - "id": 9950313, - "avatar_url": "https://avatars3.githubusercontent.com/u/9950313?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/nodejs", - "html_url": "https://github.com/nodejs", - "followers_url": "https://api.github.com/users/nodejs/followers", - "following_url": "https://api.github.com/users/nodejs/following{/other_user}", - "gists_url": "https://api.github.com/users/nodejs/gists{/gist_id}", - "starred_url": "https://api.github.com/users/nodejs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/nodejs/subscriptions", - "organizations_url": "https://api.github.com/users/nodejs/orgs", - "repos_url": "https://api.github.com/users/nodejs/repos", - "events_url": "https://api.github.com/users/nodejs/events{/privacy}", - "received_events_url": "https://api.github.com/users/nodejs/received_events", - "type": "Organization", - "site_admin": false - }, - "repo": { - "id": 107863796, - "name": "node-core-utils", - "full_name": "nodejs/node-core-utils", - "owner": { - "login": "nodejs", - "id": 9950313, - "avatar_url": "https://avatars3.githubusercontent.com/u/9950313?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/nodejs", - "html_url": "https://github.com/nodejs", - "followers_url": "https://api.github.com/users/nodejs/followers", - "following_url": "https://api.github.com/users/nodejs/following{/other_user}", - "gists_url": "https://api.github.com/users/nodejs/gists{/gist_id}", - "starred_url": "https://api.github.com/users/nodejs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/nodejs/subscriptions", - "organizations_url": "https://api.github.com/users/nodejs/orgs", - "repos_url": "https://api.github.com/users/nodejs/repos", - "events_url": "https://api.github.com/users/nodejs/events{/privacy}", - "received_events_url": "https://api.github.com/users/nodejs/received_events", - "type": "Organization", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/nodejs/node-core-utils", - "description": "CLI tools for Node.js Core collaborators", - "fork": false, - "url": "https://api.github.com/repos/nodejs/node-core-utils", - "forks_url": "https://api.github.com/repos/nodejs/node-core-utils/forks", - "keys_url": "https://api.github.com/repos/nodejs/node-core-utils/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/nodejs/node-core-utils/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/nodejs/node-core-utils/teams", - "hooks_url": "https://api.github.com/repos/nodejs/node-core-utils/hooks", - "issue_events_url": "https://api.github.com/repos/nodejs/node-core-utils/issues/events{/number}", - "events_url": "https://api.github.com/repos/nodejs/node-core-utils/events", - "assignees_url": "https://api.github.com/repos/nodejs/node-core-utils/assignees{/user}", - "branches_url": "https://api.github.com/repos/nodejs/node-core-utils/branches{/branch}", - "tags_url": "https://api.github.com/repos/nodejs/node-core-utils/tags", - "blobs_url": "https://api.github.com/repos/nodejs/node-core-utils/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/nodejs/node-core-utils/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/nodejs/node-core-utils/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/nodejs/node-core-utils/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/nodejs/node-core-utils/statuses/{sha}", - "languages_url": "https://api.github.com/repos/nodejs/node-core-utils/languages", - "stargazers_url": "https://api.github.com/repos/nodejs/node-core-utils/stargazers", - "contributors_url": "https://api.github.com/repos/nodejs/node-core-utils/contributors", - "subscribers_url": "https://api.github.com/repos/nodejs/node-core-utils/subscribers", - "subscription_url": "https://api.github.com/repos/nodejs/node-core-utils/subscription", - "commits_url": "https://api.github.com/repos/nodejs/node-core-utils/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/nodejs/node-core-utils/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/nodejs/node-core-utils/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/nodejs/node-core-utils/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/nodejs/node-core-utils/contents/{+path}", - "compare_url": "https://api.github.com/repos/nodejs/node-core-utils/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/nodejs/node-core-utils/merges", - "archive_url": "https://api.github.com/repos/nodejs/node-core-utils/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/nodejs/node-core-utils/downloads", - "issues_url": "https://api.github.com/repos/nodejs/node-core-utils/issues{/number}", - "pulls_url": "https://api.github.com/repos/nodejs/node-core-utils/pulls{/number}", - "milestones_url": "https://api.github.com/repos/nodejs/node-core-utils/milestones{/number}", - "notifications_url": "https://api.github.com/repos/nodejs/node-core-utils/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/nodejs/node-core-utils/labels{/name}", - "releases_url": "https://api.github.com/repos/nodejs/node-core-utils/releases{/id}", - "deployments_url": "https://api.github.com/repos/nodejs/node-core-utils/deployments", - "created_at": "2017-10-22T12:27:44Z", - "updated_at": "2017-11-13T18:38:29Z", - "pushed_at": "2017-11-16T11:01:42Z", - "git_url": "git://github.com/nodejs/node-core-utils.git", - "ssh_url": "git@github.com:nodejs/node-core-utils.git", - "clone_url": "https://github.com/nodejs/node-core-utils.git", - "svn_url": "https://github.com/nodejs/node-core-utils", - "homepage": "", - "size": 224, - "stargazers_count": 26, - "watchers_count": 26, - "language": "JavaScript", - "has_issues": true, - "has_projects": true, - "has_downloads": true, - "has_wiki": true, - "has_pages": false, - "forks_count": 15, - "mirror_url": null, - "archived": false, - "open_issues_count": 15, - "forks": 15, - "open_issues": 15, - "watchers": 26, - "default_branch": "master" - } - }, - "_links": { - "self": { - "href": "https://api.github.com/repos/nodejs/node-core-utils/pulls/100" - }, - "html": { - "href": "https://github.com/nodejs/node-core-utils/pull/100" - }, - "issue": { - "href": "https://api.github.com/repos/nodejs/node-core-utils/issues/100" - }, - "comments": { - "href": "https://api.github.com/repos/nodejs/node-core-utils/issues/100/comments" - }, - "review_comments": { - "href": "https://api.github.com/repos/nodejs/node-core-utils/pulls/100/comments" - }, - "review_comment": { - "href": "https://api.github.com/repos/nodejs/node-core-utils/pulls/comments{/number}" - }, - "commits": { - "href": "https://api.github.com/repos/nodejs/node-core-utils/pulls/100/commits" - }, - "statuses": { - "href": "https://api.github.com/repos/nodejs/node-core-utils/statuses/eb1c004a4dfaea361eec5b8f654ed91ea28342cb" - } - }, - "author_association": "COLLABORATOR", - "merged": false, - "mergeable": null, - "rebaseable": null, - "mergeable_state": "unknown", - "merged_by": null, - "comments": 7, - "review_comments": 0, - "maintainer_can_modify": true, - "commits": 2, - "additions": 0, - "deletions": 0, - "changed_files": 0 - }, - "before": "f19f9f6b2a599b1a391b24d51cc1657b353a7797", - "after": "eb1c004a4dfaea361eec5b8f654ed91ea28342cb", - "repository": { - "id": 107863796, - "name": "node-core-utils", - "full_name": "nodejs/node-core-utils", - "owner": { - "login": "nodejs", - "id": 9950313, - "avatar_url": "https://avatars3.githubusercontent.com/u/9950313?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/nodejs", - "html_url": "https://github.com/nodejs", - "followers_url": "https://api.github.com/users/nodejs/followers", - "following_url": "https://api.github.com/users/nodejs/following{/other_user}", - "gists_url": "https://api.github.com/users/nodejs/gists{/gist_id}", - "starred_url": "https://api.github.com/users/nodejs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/nodejs/subscriptions", - "organizations_url": "https://api.github.com/users/nodejs/orgs", - "repos_url": "https://api.github.com/users/nodejs/repos", - "events_url": "https://api.github.com/users/nodejs/events{/privacy}", - "received_events_url": "https://api.github.com/users/nodejs/received_events", - "type": "Organization", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/nodejs/node-core-utils", - "description": "CLI tools for Node.js Core collaborators", - "fork": false, - "url": "https://api.github.com/repos/nodejs/node-core-utils", - "forks_url": "https://api.github.com/repos/nodejs/node-core-utils/forks", - "keys_url": "https://api.github.com/repos/nodejs/node-core-utils/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/nodejs/node-core-utils/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/nodejs/node-core-utils/teams", - "hooks_url": "https://api.github.com/repos/nodejs/node-core-utils/hooks", - "issue_events_url": "https://api.github.com/repos/nodejs/node-core-utils/issues/events{/number}", - "events_url": "https://api.github.com/repos/nodejs/node-core-utils/events", - "assignees_url": "https://api.github.com/repos/nodejs/node-core-utils/assignees{/user}", - "branches_url": "https://api.github.com/repos/nodejs/node-core-utils/branches{/branch}", - "tags_url": "https://api.github.com/repos/nodejs/node-core-utils/tags", - "blobs_url": "https://api.github.com/repos/nodejs/node-core-utils/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/nodejs/node-core-utils/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/nodejs/node-core-utils/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/nodejs/node-core-utils/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/nodejs/node-core-utils/statuses/{sha}", - "languages_url": "https://api.github.com/repos/nodejs/node-core-utils/languages", - "stargazers_url": "https://api.github.com/repos/nodejs/node-core-utils/stargazers", - "contributors_url": "https://api.github.com/repos/nodejs/node-core-utils/contributors", - "subscribers_url": "https://api.github.com/repos/nodejs/node-core-utils/subscribers", - "subscription_url": "https://api.github.com/repos/nodejs/node-core-utils/subscription", - "commits_url": "https://api.github.com/repos/nodejs/node-core-utils/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/nodejs/node-core-utils/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/nodejs/node-core-utils/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/nodejs/node-core-utils/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/nodejs/node-core-utils/contents/{+path}", - "compare_url": "https://api.github.com/repos/nodejs/node-core-utils/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/nodejs/node-core-utils/merges", - "archive_url": "https://api.github.com/repos/nodejs/node-core-utils/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/nodejs/node-core-utils/downloads", - "issues_url": "https://api.github.com/repos/nodejs/node-core-utils/issues{/number}", - "pulls_url": "https://api.github.com/repos/nodejs/node-core-utils/pulls{/number}", - "milestones_url": "https://api.github.com/repos/nodejs/node-core-utils/milestones{/number}", - "notifications_url": "https://api.github.com/repos/nodejs/node-core-utils/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/nodejs/node-core-utils/labels{/name}", - "releases_url": "https://api.github.com/repos/nodejs/node-core-utils/releases{/id}", - "deployments_url": "https://api.github.com/repos/nodejs/node-core-utils/deployments", - "created_at": "2017-10-22T12:27:44Z", - "updated_at": "2017-11-13T18:38:29Z", - "pushed_at": "2017-11-16T11:01:42Z", - "git_url": "git://github.com/nodejs/node-core-utils.git", - "ssh_url": "git@github.com:nodejs/node-core-utils.git", - "clone_url": "https://github.com/nodejs/node-core-utils.git", - "svn_url": "https://github.com/nodejs/node-core-utils", - "homepage": "", - "size": 224, - "stargazers_count": 26, - "watchers_count": 26, - "language": "JavaScript", - "has_issues": true, - "has_projects": true, - "has_downloads": true, - "has_wiki": true, - "has_pages": false, - "forks_count": 15, - "mirror_url": null, - "archived": false, - "open_issues_count": 15, - "forks": 15, - "open_issues": 15, - "watchers": 26, - "default_branch": "master" - }, - "organization": { - "login": "nodejs", - "id": 9950313, - "url": "https://api.github.com/orgs/nodejs", - "repos_url": "https://api.github.com/orgs/nodejs/repos", - "events_url": "https://api.github.com/orgs/nodejs/events", - "hooks_url": "https://api.github.com/orgs/nodejs/hooks", - "issues_url": "https://api.github.com/orgs/nodejs/issues", - "members_url": "https://api.github.com/orgs/nodejs/members{/member}", - "public_members_url": "https://api.github.com/orgs/nodejs/public_members{/member}", - "avatar_url": "https://avatars3.githubusercontent.com/u/9950313?v=4", - "description": "" - }, - "sender": { - "login": "joyeecheung", - "id": 4299420, - "avatar_url": "https://avatars0.githubusercontent.com/u/4299420?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/joyeecheung", - "html_url": "https://github.com/joyeecheung", - "followers_url": "https://api.github.com/users/joyeecheung/followers", - "following_url": "https://api.github.com/users/joyeecheung/following{/other_user}", - "gists_url": "https://api.github.com/users/joyeecheung/gists{/gist_id}", - "starred_url": "https://api.github.com/users/joyeecheung/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/joyeecheung/subscriptions", - "organizations_url": "https://api.github.com/users/joyeecheung/orgs", - "repos_url": "https://api.github.com/users/joyeecheung/repos", - "events_url": "https://api.github.com/users/joyeecheung/events{/privacy}", - "received_events_url": "https://api.github.com/users/joyeecheung/received_events", - "type": "User", - "site_admin": false - } -} \ No newline at end of file diff --git a/test/_fixtures/pr-commits-for-travis.json b/test/_fixtures/pr-commits-for-travis.json deleted file mode 100644 index ae0ce69b..00000000 --- a/test/_fixtures/pr-commits-for-travis.json +++ /dev/null @@ -1,154 +0,0 @@ -[ - { - "sha": "4566667de07be43ecaf69d2d1a203b99a86b16e1", - "commit": { - "author": { - "name": "Joyee Cheung", - "email": "joyeec9h3@gmail.com", - "date": "2017-11-16T12:51:06Z" - }, - "committer": { - "name": "Joyee Cheung", - "email": "joyeec9h3@gmail.com", - "date": "2017-11-16T12:51:06Z" - }, - "message": "all blank", - "tree": { - "sha": "c898d81fcc9dd9e42ff6a87483139acebf27f9ff", - "url": "https://api.github.com/repos/nodejs/node-core-utils/git/trees/c898d81fcc9dd9e42ff6a87483139acebf27f9ff" - }, - "url": "https://api.github.com/repos/nodejs/node-core-utils/git/commits/4566667de07be43ecaf69d2d1a203b99a86b16e1", - "comment_count": 0, - "verification": { - "verified": false, - "reason": "unsigned", - "signature": null, - "payload": null - } - }, - "url": "https://api.github.com/repos/nodejs/node-core-utils/commits/4566667de07be43ecaf69d2d1a203b99a86b16e1", - "html_url": "https://github.com/nodejs/node-core-utils/commit/4566667de07be43ecaf69d2d1a203b99a86b16e1", - "comments_url": "https://api.github.com/repos/nodejs/node-core-utils/commits/4566667de07be43ecaf69d2d1a203b99a86b16e1/comments", - "author": { - "login": "joyeecheung", - "id": 4299420, - "avatar_url": "https://avatars0.githubusercontent.com/u/4299420?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/joyeecheung", - "html_url": "https://github.com/joyeecheung", - "followers_url": "https://api.github.com/users/joyeecheung/followers", - "following_url": "https://api.github.com/users/joyeecheung/following{/other_user}", - "gists_url": "https://api.github.com/users/joyeecheung/gists{/gist_id}", - "starred_url": "https://api.github.com/users/joyeecheung/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/joyeecheung/subscriptions", - "organizations_url": "https://api.github.com/users/joyeecheung/orgs", - "repos_url": "https://api.github.com/users/joyeecheung/repos", - "events_url": "https://api.github.com/users/joyeecheung/events{/privacy}", - "received_events_url": "https://api.github.com/users/joyeecheung/received_events", - "type": "User", - "site_admin": false - }, - "committer": { - "login": "joyeecheung", - "id": 4299420, - "avatar_url": "https://avatars0.githubusercontent.com/u/4299420?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/joyeecheung", - "html_url": "https://github.com/joyeecheung", - "followers_url": "https://api.github.com/users/joyeecheung/followers", - "following_url": "https://api.github.com/users/joyeecheung/following{/other_user}", - "gists_url": "https://api.github.com/users/joyeecheung/gists{/gist_id}", - "starred_url": "https://api.github.com/users/joyeecheung/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/joyeecheung/subscriptions", - "organizations_url": "https://api.github.com/users/joyeecheung/orgs", - "repos_url": "https://api.github.com/users/joyeecheung/repos", - "events_url": "https://api.github.com/users/joyeecheung/events{/privacy}", - "received_events_url": "https://api.github.com/users/joyeecheung/received_events", - "type": "User", - "site_admin": false - }, - "parents": [ - { - "sha": "3f145837d77ae00463dbdd867548751a670e7716", - "url": "https://api.github.com/repos/nodejs/node-core-utils/commits/3f145837d77ae00463dbdd867548751a670e7716", - "html_url": "https://github.com/nodejs/node-core-utils/commit/3f145837d77ae00463dbdd867548751a670e7716" - } - ] - }, - { - "sha": "4795f8748cc06ee220438201db3b74a9b333e21e", - "commit": { - "author": { - "name": "Joyee Cheung", - "email": "joyeec9h3@gmail.com", - "date": "2017-11-16T13:12:39Z" - }, - "committer": { - "name": "Joyee Cheung", - "email": "joyeec9h3@gmail.com", - "date": "2017-11-16T13:12:39Z" - }, - "message": "Revert \"all blank\"\n\nThis reverts commit 4566667de07be43ecaf69d2d1a203b99a86b16e1.", - "tree": { - "sha": "02bfa7ee5f8b3350dfcd17b2d2723fadd59917ec", - "url": "https://api.github.com/repos/nodejs/node-core-utils/git/trees/02bfa7ee5f8b3350dfcd17b2d2723fadd59917ec" - }, - "url": "https://api.github.com/repos/nodejs/node-core-utils/git/commits/4795f8748cc06ee220438201db3b74a9b333e21e", - "comment_count": 0, - "verification": { - "verified": false, - "reason": "unsigned", - "signature": null, - "payload": null - } - }, - "url": "https://api.github.com/repos/nodejs/node-core-utils/commits/4795f8748cc06ee220438201db3b74a9b333e21e", - "html_url": "https://github.com/nodejs/node-core-utils/commit/4795f8748cc06ee220438201db3b74a9b333e21e", - "comments_url": "https://api.github.com/repos/nodejs/node-core-utils/commits/4795f8748cc06ee220438201db3b74a9b333e21e/comments", - "author": { - "login": "joyeecheung", - "id": 4299420, - "avatar_url": "https://avatars0.githubusercontent.com/u/4299420?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/joyeecheung", - "html_url": "https://github.com/joyeecheung", - "followers_url": "https://api.github.com/users/joyeecheung/followers", - "following_url": "https://api.github.com/users/joyeecheung/following{/other_user}", - "gists_url": "https://api.github.com/users/joyeecheung/gists{/gist_id}", - "starred_url": "https://api.github.com/users/joyeecheung/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/joyeecheung/subscriptions", - "organizations_url": "https://api.github.com/users/joyeecheung/orgs", - "repos_url": "https://api.github.com/users/joyeecheung/repos", - "events_url": "https://api.github.com/users/joyeecheung/events{/privacy}", - "received_events_url": "https://api.github.com/users/joyeecheung/received_events", - "type": "User", - "site_admin": false - }, - "committer": { - "login": "joyeecheung", - "id": 4299420, - "avatar_url": "https://avatars0.githubusercontent.com/u/4299420?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/joyeecheung", - "html_url": "https://github.com/joyeecheung", - "followers_url": "https://api.github.com/users/joyeecheung/followers", - "following_url": "https://api.github.com/users/joyeecheung/following{/other_user}", - "gists_url": "https://api.github.com/users/joyeecheung/gists{/gist_id}", - "starred_url": "https://api.github.com/users/joyeecheung/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/joyeecheung/subscriptions", - "organizations_url": "https://api.github.com/users/joyeecheung/orgs", - "repos_url": "https://api.github.com/users/joyeecheung/repos", - "events_url": "https://api.github.com/users/joyeecheung/events{/privacy}", - "received_events_url": "https://api.github.com/users/joyeecheung/received_events", - "type": "User", - "site_admin": false - }, - "parents": [ - { - "sha": "4566667de07be43ecaf69d2d1a203b99a86b16e1", - "url": "https://api.github.com/repos/nodejs/node-core-utils/commits/4566667de07be43ecaf69d2d1a203b99a86b16e1", - "html_url": "https://github.com/nodejs/node-core-utils/commit/4566667de07be43ecaf69d2d1a203b99a86b16e1" - } - ] - } -] diff --git a/test/_fixtures/travis-build-created.json b/test/_fixtures/travis-build-created.json deleted file mode 100644 index 6ed72079..00000000 --- a/test/_fixtures/travis-build-created.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "builds": [ - { - "id": 302956738, - "repository_id": 15864968, - "commit_id": 89377517, - "number": "322", - "event_type": "pull_request", - "pull_request": true, - "pull_request_title": "Testing github intergrations", - "pull_request_number": 100, - "config": { - "language": "node_js", - "node_js": [ - "9", - "8" - ], - "sudo": false, - "cache": { - "directories": [ - "node_modules" - ] - }, - "script": [ - "npm run lint", - "npm run coverage-all" - ], - "after_success": [ - "npm run report-coverage" - ], - ".result": "configured", - "group": "stable", - "dist": "trusty" - }, - "state": "created", - "started_at": "2017-11-16T10:46:47Z", - "finished_at": "2017-11-16T10:48:40Z", - "duration": 189, - "job_ids": [ - 302956739, - 302956740 - ] - } - ], - "jobs": [ ], - "commits": [ - { - "id": 89377517, - "sha": "4795f8748cc06ee220438201db3b74a9b333e21e", - "branch": "master", - "tag": null, - "message": "Revert \"all blank\"\n\nThis reverts commit 4566667de07be43ecaf69d2d1a203b99a86b16e1.", - "committed_at": "2017-11-16T13:12:39Z", - "author_name": "Joyee Cheung", - "author_email": "joyeec9h3@gmail.com", - "committer_name": "Joyee Cheung", - "committer_email": "joyeec9h3@gmail.com", - "compare_url": "https://github.com/nodejs/node-core-utils/pull/100", - "pull_request_number": 100 - }, - { - "id": 89393833, - "sha": "4566667de07be43ecaf69d2d1a203b99a86b16e1", - "branch": "master", - "tag": null, - "message": "all blank", - "committed_at": "2017-11-16T12:51:06Z", - "author_name": "Joyee Cheung", - "author_email": "joyeec9h3@gmail.com", - "committer_name": "Joyee Cheung", - "committer_email": "joyeec9h3@gmail.com", - "compare_url": "https://github.com/nodejs/node-core-utils/pull/100", - "pull_request_number": 100 - }] -} \ No newline at end of file diff --git a/test/_fixtures/travis-build-failed.json b/test/_fixtures/travis-build-failed.json deleted file mode 100644 index 1025d4de..00000000 --- a/test/_fixtures/travis-build-failed.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "builds": [ - { - "id": 302956738, - "repository_id": 15864968, - "commit_id": 89377517, - "number": "322", - "event_type": "pull_request", - "pull_request": true, - "pull_request_title": "Testing github intergrations", - "pull_request_number": 100, - "config": { - "language": "node_js", - "node_js": [ - "9", - "8" - ], - "sudo": false, - "cache": { - "directories": [ - "node_modules" - ] - }, - "script": [ - "npm run lint", - "npm run coverage-all" - ], - "after_success": [ - "npm run report-coverage" - ], - ".result": "configured", - "group": "stable", - "dist": "trusty" - }, - "state": "failed", - "started_at": "2017-11-16T10:46:47Z", - "finished_at": "2017-11-16T10:48:40Z", - "duration": 189, - "job_ids": [ - 302956739, - 302956740 - ] - } - ], - "jobs": [ ], - "commits": [ - { - "id": 89377517, - "sha": "4795f8748cc06ee220438201db3b74a9b333e21e", - "branch": "master", - "tag": null, - "message": "Revert \"all blank\"\n\nThis reverts commit 4566667de07be43ecaf69d2d1a203b99a86b16e1.", - "committed_at": "2017-11-16T13:12:39Z", - "author_name": "Joyee Cheung", - "author_email": "joyeec9h3@gmail.com", - "committer_name": "Joyee Cheung", - "committer_email": "joyeec9h3@gmail.com", - "compare_url": "https://github.com/nodejs/node-core-utils/pull/100", - "pull_request_number": 100 - }, - { - "id": 89393833, - "sha": "4566667de07be43ecaf69d2d1a203b99a86b16e1", - "branch": "master", - "tag": null, - "message": "all blank", - "committed_at": "2017-11-16T12:51:06Z", - "author_name": "Joyee Cheung", - "author_email": "joyeec9h3@gmail.com", - "committer_name": "Joyee Cheung", - "committer_email": "joyeec9h3@gmail.com", - "compare_url": "https://github.com/nodejs/node-core-utils/pull/100", - "pull_request_number": 100 - }] -} \ No newline at end of file diff --git a/test/_fixtures/travis-build-no-commits.json b/test/_fixtures/travis-build-no-commits.json deleted file mode 100644 index c171055f..00000000 --- a/test/_fixtures/travis-build-no-commits.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "builds": [ - { - "id": 302956738, - "repository_id": 15864968, - "commit_id": 89377517, - "number": "322", - "event_type": "pull_request", - "pull_request": true, - "pull_request_title": "Testing github intergrations", - "pull_request_number": 100, - "config": { - "language": "node_js", - "node_js": [ - "9", - "8" - ], - "sudo": false, - "cache": { - "directories": [ - "node_modules" - ] - }, - "script": [ - "npm run lint", - "npm run coverage-all" - ], - "after_success": [ - "npm run report-coverage" - ], - ".result": "configured", - "group": "stable", - "dist": "trusty" - }, - "state": "created", - "started_at": "2017-11-16T10:46:47Z", - "finished_at": "2017-11-16T10:48:40Z", - "duration": 189, - "job_ids": [ - 302956739, - 302956740 - ] - } - ], - "jobs": [ ], - "commits": [ ] -} \ No newline at end of file diff --git a/test/_fixtures/travis-build-passed.json b/test/_fixtures/travis-build-passed.json deleted file mode 100644 index 0b134529..00000000 --- a/test/_fixtures/travis-build-passed.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "builds": [ - { - "id": 302956738, - "repository_id": 15864968, - "commit_id": 89377517, - "number": "322", - "event_type": "pull_request", - "pull_request": true, - "pull_request_title": "Testing github intergrations", - "pull_request_number": 100, - "config": { - "language": "node_js", - "node_js": [ - "9", - "8" - ], - "sudo": false, - "cache": { - "directories": [ - "node_modules" - ] - }, - "script": [ - "npm run lint", - "npm run coverage-all" - ], - "after_success": [ - "npm run report-coverage" - ], - ".result": "configured", - "group": "stable", - "dist": "trusty" - }, - "state": "passed", - "started_at": "2017-11-16T10:46:47Z", - "finished_at": "2017-11-16T10:48:40Z", - "duration": 189, - "job_ids": [ - 302956739, - 302956740 - ] - } - ], - "jobs": [ ], - "commits": [ - { - "id": 89377517, - "sha": "4795f8748cc06ee220438201db3b74a9b333e21e", - "branch": "master", - "tag": null, - "message": "Revert \"all blank\"\n\nThis reverts commit 4566667de07be43ecaf69d2d1a203b99a86b16e1.", - "committed_at": "2017-11-16T13:12:39Z", - "author_name": "Joyee Cheung", - "author_email": "joyeec9h3@gmail.com", - "committer_name": "Joyee Cheung", - "committer_email": "joyeec9h3@gmail.com", - "compare_url": "https://github.com/nodejs/node-core-utils/pull/100", - "pull_request_number": 100 - }, - { - "id": 89393833, - "sha": "4566667de07be43ecaf69d2d1a203b99a86b16e1", - "branch": "master", - "tag": null, - "message": "all blank", - "committed_at": "2017-11-16T12:51:06Z", - "author_name": "Joyee Cheung", - "author_email": "joyeec9h3@gmail.com", - "committer_name": "Joyee Cheung", - "committer_email": "joyeec9h3@gmail.com", - "compare_url": "https://github.com/nodejs/node-core-utils/pull/100", - "pull_request_number": 100 - }] -} \ No newline at end of file diff --git a/test/integration/poll-travis-status.test.js b/test/integration/poll-travis-status.test.js deleted file mode 100644 index e6c92d2c..00000000 --- a/test/integration/poll-travis-status.test.js +++ /dev/null @@ -1,156 +0,0 @@ -'use strict' - -const tap = require('tap') -const url = require('url') -const nock = require('nock') -const readFixture = require('../read-fixture') - -const logger = require('../../lib/logger') -const pollTravis = require('../../lib/pollTravis') - -tap.test('Poll for Travis builds', (t) => { - const commitsResponse = readFixture('pr-commits-for-travis.json') - const prCommitsScope = nock('https://api.github.com') - .filteringPath(ignoreQueryParams) - .get('/repos/nodejs/node-core-utils/pulls/100/commits') - .reply(200, commitsResponse) - - const buildWithoutCommits = readFixture('travis-build-no-commits.json') - const buildCreated = readFixture('travis-build-created.json') - const buildPassed = readFixture('travis-build-passed.json') - const noCommitBuildScope = nock('https://api.travis-ci.org') - .filteringPath(ignoreQueryParams) - .get('/repos/nodejs/node-core-utils/builds') - .reply(200, buildWithoutCommits) - const createdBuildScope = nock('https://api.travis-ci.org') - .filteringPath(ignoreQueryParams) - .get('/repos/nodejs/node-core-utils/builds') - .reply(200, buildCreated) - const passedBuildScope = nock('https://api.travis-ci.org') - .filteringPath(ignoreQueryParams) - .get('/repos/nodejs/node-core-utils/builds') - .reply(200, buildPassed) - - const pendingStatusScope = nock('https://api.github.com') - .filteringPath(ignoreQueryParams) - .post('/repos/nodejs/node-core-utils/statuses/4795f8748cc06ee220438201db3b74a9b333e21e', { - 'state': 'pending', - 'target_url': 'https://travis-ci.org/nodejs/node-core-utils/builds/302956738', - 'description': 'build in progress', - 'context': 'Travis CI via nodejs-github-bot' - }) - .reply(201) - - const passedStatusScope = nock('https://api.github.com') - .filteringPath(ignoreQueryParams) - .post('/repos/nodejs/node-core-utils/statuses/4795f8748cc06ee220438201db3b74a9b333e21e', { - 'state': 'success', - 'target_url': 'https://travis-ci.org/nodejs/node-core-utils/builds/302956738', - 'description': 'all tests passed', - 'context': 'Travis CI via nodejs-github-bot' - }) - .reply(201) - - t.tearDown(() => { - nock.cleanAll() - }) - - pollTravis.pollThenStatus({ - owner: 'nodejs', - repo: 'node-core-utils', - pr: 100, - retry: 10, - interval: 0.01, - logger: logger - }) - - setTimeout(() => { - prCommitsScope.done() - noCommitBuildScope.done() - createdBuildScope.done() - passedBuildScope.done() - pendingStatusScope.done() - passedStatusScope.done() - t.end() - }, 100) -}) - -tap.test('Skip if cannot get the commits', (t) => { - const prCommitsScope = nock('https://api.github.com') - .filteringPath(ignoreQueryParams) - .get('/repos/nodejs/node-core-utils/pulls/100/commits') - .reply(404) - - const travisScope = nock('https://api.travis-ci.org') - .filteringPath(ignoreQueryParams) - .get('/repos/nodejs/node-core-utils/builds') - .reply(404) - - pollTravis.pollThenStatus({ - owner: 'nodejs', - repo: 'node-core-utils', - pr: 100, - retry: 10, - interval: 0.01, - logger: logger - }) - - t.plan(1) - - t.tearDown(() => { - nock.cleanAll() - }) - - setTimeout(() => { - prCommitsScope.done() - t.ok(!travisScope.isDone()) - }, 100) -}) - -tap.test('Handle build failure', (t) => { - const commitsResponse = readFixture('pr-commits-for-travis.json') - const prCommitsScope = nock('https://api.github.com') - .filteringPath(ignoreQueryParams) - .get('/repos/nodejs/node-core-utils/pulls/100/commits') - .reply(200, commitsResponse) - - const buildFailed = readFixture('travis-build-failed.json') - const failedBuildScope = nock('https://api.travis-ci.org') - .filteringPath(ignoreQueryParams) - .get('/repos/nodejs/node-core-utils/builds') - .reply(200, buildFailed) - - const failedStatusScope = nock('https://api.github.com') - .filteringPath(ignoreQueryParams) - .post('/repos/nodejs/node-core-utils/statuses/4795f8748cc06ee220438201db3b74a9b333e21e', { - 'state': 'failure', - 'target_url': 'https://travis-ci.org/nodejs/node-core-utils/builds/302956738', - 'description': 'build failure', - 'context': 'Travis CI via nodejs-github-bot' - }) - .reply(201) - - t.tearDown(() => { - nock.cleanAll() - }) - - pollTravis.pollThenStatus({ - owner: 'nodejs', - repo: 'node-core-utils', - pr: 100, - retry: 10, - interval: 0.01, - logger: logger - }) - - setTimeout(() => { - prCommitsScope.done() - failedBuildScope.done() - failedStatusScope.done() - t.end() - }, 100) -}) - -function ignoreQueryParams (pathAndQuery) { - return url.parse(pathAndQuery, true).pathname -} diff --git a/test/unit/display-travis-status.test.js b/test/unit/display-travis-status.test.js deleted file mode 100644 index 2cc84134..00000000 --- a/test/unit/display-travis-status.test.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict' - -const tap = require('tap') -const supertest = require('supertest') -const proxyquire = require('proxyquire') -const readFixture = require('../read-fixture') - -tap.test('Poll for Travis builds when PR is updated', (t) => { - t.plan(6) - - const pollStub = (options) => { - t.equal(options.owner, 'nodejs') - t.equal(options.repo, 'node-core-utils') - t.equal(options.pr, 100) - t.equal(options.retry, 20) - t.equal(options.interval, 30) - } - - const testStubs = { - './github-secret': { - isValid: () => true, - '@global': true - }, - '../lib/pollTravis': { - pollThenStatus: pollStub, - '@global': true - } - } - - const app = proxyquire('../../app', testStubs) - - const githubPayload = readFixture('github-pr-payload.json') - supertest(app) - .post('/hooks/github') - .set('x-github-event', 'pull_request') - .send(githubPayload) - .expect(200) - .end((err, res) => { - t.equal(err, null) - }) -}) - -tap.test('Poll for Travis builds when manually triggered', (t) => { - t.plan(6) - - const pollStub = (options) => { - t.equal(options.owner, 'nodejs') - t.equal(options.repo, 'node-core-utils') - t.equal(options.pr, 100) - t.equal(options.retry, 20) - t.equal(options.interval, 30) - } - - const testStubs = { - './github-secret': { - isValid: () => true, - '@global': true - }, - '../lib/pollTravis': { - pollThenStatus: pollStub, - '@global': true - } - } - - const app = proxyquire('../../app', testStubs) - - supertest(app) - .get('/pr/nodejs/node-core-utils/100') - .expect(201) - .end((err, res) => { - t.equal(err, null) - }) -}) - -tap.test('Return 404 when repo has not been enabled', (t) => { - t.plan(1) - - const pollStub = (options) => { - t.fail('should not be called') - } - - const testStubs = { - './github-secret': { - isValid: () => true, - '@global': true - }, - '../lib/pollTravis': { - pollThenStatus: pollStub, - '@global': true - } - } - - const app = proxyquire('../../app', testStubs) - - supertest(app) - .get('/pr/nodejs/not-valid-repo/100') - .expect(404) - .end((err, res) => { - t.equal(err, null) - }) -}) From 6b3de21ed7cba1af868159a142003e1f63a3d025 Mon Sep 17 00:00:00 2001 From: Phillip Johnsen Date: Fri, 15 Jun 2018 22:54:46 +0200 Subject: [PATCH 2/3] chore: update years in LICENSE.md Primarily as a test to hopefully trigger the newly added Travis CI GitHub app. --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 7002f97c..cae82d6e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ The MIT License (MIT) ===================== -Copyright (c) 2016 Node.js Github Bot contributors +Copyright (c) 2016-2018 Node.js Github Bot contributors -------------------------------------------------- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated From e8d7f8c485e0b37758c03d94605ed6cf3c146dad Mon Sep 17 00:00:00 2001 From: Phillip Johnsen Date: Fri, 15 Jun 2018 23:27:04 +0200 Subject: [PATCH 3/3] jenkins: fix linting issue --- scripts/trigger-jenkins-build.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/trigger-jenkins-build.js b/scripts/trigger-jenkins-build.js index 7ed60457..8539c8ba 100644 --- a/scripts/trigger-jenkins-build.js +++ b/scripts/trigger-jenkins-build.js @@ -166,7 +166,8 @@ module.exports = (app) => { triggerBuild(options, replyToCollabWithBuildStarted) } - if (repo === 'node') + if (repo === 'node') { githubClient.repos.checkCollaborator({ owner, repo, username: pullRequestAuthor }, triggerBuildWhenCollaborator) + } }) }