diff --git a/README.md b/README.md index fa302870a..4dd088916 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ release-please release-pr --package-name=@google-cloud/firestore" \ | `--package-name` | is the name of the package to publish to publish to an upstream registry such as npm. | | `--repo-url` | is the URL of the repository on GitHub. | | `--token` | a token with write access to `--repo-url`. | +| `--default-branch`| branch to open pull release PR against (detected by default). | ### Creating a release on GitHub diff --git a/__snapshots__/java-bom.js b/__snapshots__/java-bom.js index ff9f5682c..d0cf0d90f 100644 --- a/__snapshots__/java-bom.js +++ b/__snapshots__/java-bom.js @@ -819,21 +819,12 @@ exports['pom-bom'] = ` ` -exports['PR body-bom'] = ` -:robot: I have created a release \\*beep\\* \\*boop\\* ---- -## [0.124.0](https://www.github.com/googleapis/java-cloud-bom/compare/0.123.4...v0.124.0) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-spanner to v1.50.0 ([1f9663c](https://www.github.com/googleapis/java-cloud-bom/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373)) -* update dependency com.google.cloud:google-cloud-storage to v1.120.0 ([fcd1c89](https://www.github.com/googleapis/java-cloud-bom/commit/fcd1c890dc1526f4d62ceedad561f498195c8939)) ---- - - -This PR was generated with [Release Please](https://github.com/googleapis/release-please). -` +exports['PR body-bom'] = { + 'title': 'chore: release 0.124.0', + 'body': ':robot: I have created a release \\*beep\\* \\*boop\\* \n---\n## [0.124.0](https://www.github.com/googleapis/java-cloud-bom/compare/0.123.4...v0.124.0) \n\n\n### Dependencies\n\n* update dependency com.google.cloud:google-cloud-spanner to v1.50.0 ([1f9663c](https://www.github.com/googleapis/java-cloud-bom/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373))\n* update dependency com.google.cloud:google-cloud-storage to v1.120.0 ([fcd1c89](https://www.github.com/googleapis/java-cloud-bom/commit/fcd1c890dc1526f4d62ceedad561f498195c8939))\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).', + 'head': 'release-v0.124.0', + 'base': 'main' +} exports['labels-bom'] = { 'labels': [ @@ -1603,15 +1594,12 @@ exports['pom-bom-snapshot'] = ` ` -exports['PR body-bom-snapshot'] = ` -:robot: I have created a release \\*beep\\* \\*boop\\* ---- -### Updating meta-information for bleeding-edge SNAPSHOT release. ---- - - -This PR was generated with [Release Please](https://github.com/googleapis/release-please). -` +exports['PR body-bom-snapshot'] = { + 'title': 'chore: release 0.123.5-SNAPSHOT', + 'body': ':robot: I have created a release \\*beep\\* \\*boop\\* \n---\n### Updating meta-information for bleeding-edge SNAPSHOT release.\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).', + 'head': 'release-v0.123.5-SNAPSHOT', + 'base': 'main' +} exports['labels-bom-snapshot'] = { 'labels': [ @@ -2444,25 +2432,12 @@ exports['pom-bom-feature'] = ` ` -exports['PR body-bom-feature'] = ` -:robot: I have created a release \\*beep\\* \\*boop\\* ---- -## [0.124.0](https://www.github.com/googleapis/java-cloud-bom/compare/0.123.4...v0.124.0) - - -### Features - -* import google-cloud-game-servers ([1f9663c](https://www.github.com/googleapis/java-cloud-bom/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-storage to v1.120.1 ([fcd1c89](https://www.github.com/googleapis/java-cloud-bom/commit/fcd1c890dc1526f4d62ceedad561f498195c8939)) ---- - - -This PR was generated with [Release Please](https://github.com/googleapis/release-please). -` +exports['PR body-bom-feature'] = { + 'title': 'chore: release 0.124.0', + 'body': ':robot: I have created a release \\*beep\\* \\*boop\\* \n---\n## [0.124.0](https://www.github.com/googleapis/java-cloud-bom/compare/0.123.4...v0.124.0) \n\n\n### Features\n\n* import google-cloud-game-servers ([1f9663c](https://www.github.com/googleapis/java-cloud-bom/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373))\n\n\n### Dependencies\n\n* update dependency com.google.cloud:google-cloud-storage to v1.120.1 ([fcd1c89](https://www.github.com/googleapis/java-cloud-bom/commit/fcd1c890dc1526f4d62ceedad561f498195c8939))\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).', + 'head': 'release-v0.124.0', + 'base': 'master' +} exports['labels-bom-feature'] = { 'labels': [ diff --git a/__snapshots__/java-yoshi.js b/__snapshots__/java-yoshi.js index 7e4fc8845..303bfe319 100644 --- a/__snapshots__/java-yoshi.js +++ b/__snapshots__/java-yoshi.js @@ -476,20 +476,12 @@ exports['pom'] = ` ` -exports['PR body'] = ` -:robot: I have created a release \\*beep\\* \\*boop\\* ---- -### [0.20.4](https://www.github.com/googleapis/java-trace/compare/v0.20.3...v0.20.4) - - -### Bug Fixes - -* Fix declared dependencies from merge issue ([#291](https://www.github.com/googleapis/java-trace/issues/291)) ([35abf13](https://www.github.com/googleapis/java-trace/commit/35abf13fa8acb3988aa086f3eb23f5ce1483cc5d)) ---- - - -This PR was generated with [Release Please](https://github.com/googleapis/release-please). -` +exports['PR body'] = { + 'title': 'chore: release 0.20.4', + 'body': ':robot: I have created a release \\*beep\\* \\*boop\\* \n---\n### [0.20.4](https://www.github.com/googleapis/java-trace/compare/v0.20.3...v0.20.4) \n\n\n### Bug Fixes\n\n* Fix declared dependencies from merge issue ([#291](https://www.github.com/googleapis/java-trace/issues/291)) ([35abf13](https://www.github.com/googleapis/java-trace/commit/35abf13fa8acb3988aa086f3eb23f5ce1483cc5d))\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).', + 'head': 'release-v0.20.4', + 'base': 'master' +} exports['labels'] = { 'labels': [ @@ -860,15 +852,12 @@ exports['pom-snapshot'] = ` ` -exports['PR body-snapshot'] = ` -:robot: I have created a release \\*beep\\* \\*boop\\* ---- -### Updating meta-information for bleeding-edge SNAPSHOT release. ---- - - -This PR was generated with [Release Please](https://github.com/googleapis/release-please). -` +exports['PR body-snapshot'] = { + 'title': 'chore: release 0.20.4-SNAPSHOT', + 'body': ':robot: I have created a release \\*beep\\* \\*boop\\* \n---\n### Updating meta-information for bleeding-edge SNAPSHOT release.\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).', + 'head': 'release-v0.20.4-SNAPSHOT', + 'base': 'main' +} exports['labels-snapshot'] = { 'labels': [ diff --git a/__snapshots__/release-pr-factory.js b/__snapshots__/release-pr-factory.js index c5bd2e55b..2becc4642 100644 --- a/__snapshots__/release-pr-factory.js +++ b/__snapshots__/release-pr-factory.js @@ -16,21 +16,12 @@ exports['ReleasePRFactory build returns instance of dynamically loaded releaser ` -exports['ReleasePRFactory build returns instance of dynamically loaded releaser 3'] = ` -:robot: I have created a release \\*beep\\* \\*boop\\* ---- -### [0.123.5](https://www.github.com/googleapis/simple-test-repo/compare/v0.123.4...v0.123.5) - - -### Bug Fixes - -* **deps:** update dependency com.google.cloud:google-cloud-spanner to v1.50.0 ([1f9663c](https://www.github.com/googleapis/simple-test-repo/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373)) -* **deps:** update dependency com.google.cloud:google-cloud-storage to v1.120.0 ([fcd1c89](https://www.github.com/googleapis/simple-test-repo/commit/fcd1c890dc1526f4d62ceedad561f498195c8939)) ---- - - -This PR was generated with [Release Please](https://github.com/googleapis/release-please). -` +exports['ReleasePRFactory build returns instance of dynamically loaded releaser 3'] = { + 'title': 'chore: release 0.123.5', + 'body': ':robot: I have created a release \\*beep\\* \\*boop\\* \n---\n### [0.123.5](https://www.github.com/googleapis/simple-test-repo/compare/v0.123.4...v0.123.5) \n\n\n### Bug Fixes\n\n* **deps:** update dependency com.google.cloud:google-cloud-spanner to v1.50.0 ([1f9663c](https://www.github.com/googleapis/simple-test-repo/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373))\n* **deps:** update dependency com.google.cloud:google-cloud-storage to v1.120.0 ([fcd1c89](https://www.github.com/googleapis/simple-test-repo/commit/fcd1c890dc1526f4d62ceedad561f498195c8939))\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).', + 'head': 'release-v0.123.5', + 'base': 'main' +} exports['ReleasePRFactory build returns instance of dynamically loaded releaser 4'] = { 'labels': [ @@ -56,21 +47,12 @@ exports['ReleasePRFactory buildStatic returns an instance of a statically loaded ` -exports['ReleasePRFactory buildStatic returns an instance of a statically loaded releaser 3'] = ` -:robot: I have created a release \\*beep\\* \\*boop\\* ---- -### [0.123.5](https://www.github.com/googleapis/simple-test-repo/compare/v0.123.4...v0.123.5) - - -### Bug Fixes - -* **deps:** update dependency com.google.cloud:google-cloud-spanner to v1.50.0 ([1f9663c](https://www.github.com/googleapis/simple-test-repo/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373)) -* **deps:** update dependency com.google.cloud:google-cloud-storage to v1.120.0 ([fcd1c89](https://www.github.com/googleapis/simple-test-repo/commit/fcd1c890dc1526f4d62ceedad561f498195c8939)) ---- - - -This PR was generated with [Release Please](https://github.com/googleapis/release-please). -` +exports['ReleasePRFactory buildStatic returns an instance of a statically loaded releaser 3'] = { + 'title': 'chore: release 0.123.5', + 'body': ':robot: I have created a release \\*beep\\* \\*boop\\* \n---\n### [0.123.5](https://www.github.com/googleapis/simple-test-repo/compare/v0.123.4...v0.123.5) \n\n\n### Bug Fixes\n\n* **deps:** update dependency com.google.cloud:google-cloud-spanner to v1.50.0 ([1f9663c](https://www.github.com/googleapis/simple-test-repo/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373))\n* **deps:** update dependency com.google.cloud:google-cloud-storage to v1.120.0 ([fcd1c89](https://www.github.com/googleapis/simple-test-repo/commit/fcd1c890dc1526f4d62ceedad561f498195c8939))\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).', + 'head': 'release-v0.123.5', + 'base': 'main' +} exports['ReleasePRFactory buildStatic returns an instance of a statically loaded releaser 4'] = { 'labels': [ diff --git a/__snapshots__/release-pr.js b/__snapshots__/release-pr.js index 7ee7b6f7e..c1ed3ddda 100644 --- a/__snapshots__/release-pr.js +++ b/__snapshots__/release-pr.js @@ -18,60 +18,9 @@ exports['GitHub Yoshi PHP Mono-Repo generates CHANGELOG and aborts if duplicate ` -exports['GitHub Yoshi PHP Mono-Repo generates CHANGELOG and aborts if duplicate 2'] = ` -:robot: I have created a release \\*beep\\* \\*boop\\* ---- -## 0.21.0 - -
automl 1.8.4 - - - -### Bug Fixes - -* correctly label as beta ([#1963](https://www.github.com/googleapis/release-please/issues/1963)) ([52f4fbf](https://www.github.com/googleapis/release-please/commit/52f4fbfa1fc3fde585c84e64ef40571d2b85d72e)) - -
- -
datastore 2.0.1 - - - -### Bug Fixes - -* Assorted minor fixes for Cloud Datastore client ([#1964](https://www.github.com/googleapis/release-please/issues/1964)) ([269cf92](https://www.github.com/googleapis/release-please/commit/269cf923ea6fd0375abaf0bb19790475693c6f90)) - -
- -
pubsub 1.0.2 - - - -### Bug Fixes - -* Update PubSub timeouts. ([#1967](https://www.github.com/googleapis/release-please/issues/1967)) ([0a84771](https://www.github.com/googleapis/release-please/commit/0a8477108a26aeb21d7af06e62be4ae5cb00ad42)) - -
- -
speech 1.1.0 - - - -### Features - -* move speech from alpha -> beta ([#1962](https://www.github.com/googleapis/release-please/issues/1962)) ([8db7f3b](https://www.github.com/googleapis/release-please/commit/8db7f3b19c46c873897d79c89ce35b8492e5fe60)) - -
- -
websecurityscanner 0.9.0 - - - -### Features - -* Add Web Security Center Client ([#1961](https://www.github.com/googleapis/release-please/issues/1961)) ([fa5761e](https://www.github.com/googleapis/release-please/commit/fa5761e9e52f36506a72a9292843259d198468b0)) - -
- -This PR was generated with [Release Please](https://github.com/googleapis/release-please). -` +exports['GitHub Yoshi PHP Mono-Repo generates CHANGELOG and aborts if duplicate 2'] = { + 'title': 'chore: release 0.21.0', + 'body': ':robot: I have created a release \\*beep\\* \\*boop\\* \n---\n## 0.21.0\n\n
automl 1.8.4\n\n\n\n### Bug Fixes\n\n* correctly label as beta ([#1963](https://www.github.com/googleapis/release-please/issues/1963)) ([52f4fbf](https://www.github.com/googleapis/release-please/commit/52f4fbfa1fc3fde585c84e64ef40571d2b85d72e))\n\n
\n\n
datastore 2.0.1\n\n\n\n### Bug Fixes\n\n* Assorted minor fixes for Cloud Datastore client ([#1964](https://www.github.com/googleapis/release-please/issues/1964)) ([269cf92](https://www.github.com/googleapis/release-please/commit/269cf923ea6fd0375abaf0bb19790475693c6f90))\n\n
\n\n
pubsub 1.0.2\n\n\n\n### Bug Fixes\n\n* Update PubSub timeouts. ([#1967](https://www.github.com/googleapis/release-please/issues/1967)) ([0a84771](https://www.github.com/googleapis/release-please/commit/0a8477108a26aeb21d7af06e62be4ae5cb00ad42))\n\n
\n\n
speech 1.1.0\n\n\n\n### Features\n\n* move speech from alpha -> beta ([#1962](https://www.github.com/googleapis/release-please/issues/1962)) ([8db7f3b](https://www.github.com/googleapis/release-please/commit/8db7f3b19c46c873897d79c89ce35b8492e5fe60))\n\n
\n\n
websecurityscanner 0.9.0\n\n\n\n### Features\n\n* Add Web Security Center Client ([#1961](https://www.github.com/googleapis/release-please/issues/1961)) ([fa5761e](https://www.github.com/googleapis/release-please/commit/fa5761e9e52f36506a72a9292843259d198468b0))\n\n
\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).', + 'head': 'release-v0.21.0', + 'base': 'master' +} diff --git a/__snapshots__/simple.js b/__snapshots__/simple.js index 7d97fb091..549687376 100644 --- a/__snapshots__/simple.js +++ b/__snapshots__/simple.js @@ -16,21 +16,12 @@ exports['version-txt-simple'] = ` ` -exports['PR body-simple'] = ` -:robot: I have created a release \\*beep\\* \\*boop\\* ---- -### [0.123.5](https://www.github.com/googleapis/simple-test-repo/compare/v0.123.4...v0.123.5) - - -### Bug Fixes - -* **deps:** update dependency com.google.cloud:google-cloud-spanner to v1.50.0 ([1f9663c](https://www.github.com/googleapis/simple-test-repo/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373)) -* **deps:** update dependency com.google.cloud:google-cloud-storage to v1.120.0 ([fcd1c89](https://www.github.com/googleapis/simple-test-repo/commit/fcd1c890dc1526f4d62ceedad561f498195c8939)) ---- - - -This PR was generated with [Release Please](https://github.com/googleapis/release-please). -` +exports['PR body-simple'] = { + 'title': 'chore: release 0.123.5', + 'body': ':robot: I have created a release \\*beep\\* \\*boop\\* \n---\n### [0.123.5](https://www.github.com/googleapis/simple-test-repo/compare/v0.123.4...v0.123.5) \n\n\n### Bug Fixes\n\n* **deps:** update dependency com.google.cloud:google-cloud-spanner to v1.50.0 ([1f9663c](https://www.github.com/googleapis/simple-test-repo/commit/1f9663cf08ab1cf3b68d95dee4dc99b7c4aac373))\n* **deps:** update dependency com.google.cloud:google-cloud-storage to v1.120.0 ([fcd1c89](https://www.github.com/googleapis/simple-test-repo/commit/fcd1c890dc1526f4d62ceedad561f498195c8939))\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please).', + 'head': 'release-v0.123.5', + 'base': 'master' +} exports['labels-simple'] = { 'labels': [ diff --git a/src/bin/release-please.ts b/src/bin/release-please.ts index 0716f3c07..a38d5a0d1 100644 --- a/src/bin/release-please.ts +++ b/src/bin/release-please.ts @@ -68,6 +68,10 @@ const argv = yargs describe: 'is it a snapshot (or pre-release) being generated?', type: 'boolean', default: false, + }) + .option('default-branch', { + describe: 'default branch to open release PR against', + type: 'string', }); }, (argv: ReleasePROptions) => { @@ -140,6 +144,10 @@ const argv = yargs default: false, type: 'boolean', }) + .option('default-branch', { + describe: '', + type: 'string', + }) .demandCommand(1) .strict(true) .parse(); diff --git a/src/github.ts b/src/github.ts index 59717736b..3fbc66976 100644 --- a/src/github.ts +++ b/src/github.ts @@ -65,6 +65,7 @@ export interface OctokitAPIs { } interface GitHubOptions { + defaultBranch?: string; token?: string; owner: string; repo: string; @@ -108,6 +109,7 @@ interface FileSearchResponseFile { let probotMode = false; export class GitHub { + defaultBranch?: string; octokit: OctokitType; request: Function; graphql: Function; @@ -118,6 +120,7 @@ export class GitHub { proxyKey?: string; constructor(options: GitHubOptions) { + this.defaultBranch = options.defaultBranch; this.token = options.token; this.owner = options.owner; this.repo = options.repo; @@ -674,7 +677,7 @@ export class GitHub { } await this.updateFiles(options.updates, options.branch, refName); - + const base = await this.getDefaultBranch(this.owner, this.repo); if (openReleasePR) { // TODO: dig into why `updateRef` closes an issue attached // to the branch being updated: @@ -696,7 +699,7 @@ export class GitHub { title: options.title, body: options.body, state: 'open', - base: 'master', + base, } ); return openReleasePR.number; @@ -715,13 +718,25 @@ export class GitHub { title: options.title, body: options.body, head: options.branch, - base: 'master', + base, } ); return resp.data.number; } } + private async getDefaultBranch(owner: string, repo: string): Promise { + if (this.defaultBranch) { + return this.defaultBranch; + } + const {data} = await this.octokit.repos.get({ + repo, + owner, + }); + this.defaultBranch = data.default_branch; + return this.defaultBranch; + } + async updateFiles(updates: Update[], branch: string, refName: string) { // does the user care about skipping CI at all? const skipCiEverSet = updates.some( diff --git a/src/graphql-to-commits.ts b/src/graphql-to-commits.ts index 506b64032..1b9ea41ec 100644 --- a/src/graphql-to-commits.ts +++ b/src/graphql-to-commits.ts @@ -94,8 +94,6 @@ export async function graphqlToCommits( commitEdge, observedSHAs ); - // if the commit and its associated PR do not share a sha, we assume - // that the commit was a push to master and disregard it. if (commit) { commits.commits.push(commit); } @@ -124,7 +122,7 @@ async function graphqlToCommit( let prEdge: PREdge = commitEdge.node.associatedPullRequests.edges[0]; // if the commit.sha and mergeCommit.oid do not match, assume that this - // was a push to master and drop the commit. + // was a push directly to the default branch. // // TODO: investigate our motivations for skipping commits when // commitEdge.node.oid and prEdge.node.mergeCommit.oid do not match (this diff --git a/src/release-pr.ts b/src/release-pr.ts index 07824f84b..ed41e07a5 100644 --- a/src/release-pr.ts +++ b/src/release-pr.ts @@ -36,6 +36,7 @@ const parseGithubRepoUrl = require('parse-github-repo-url'); export interface BuildOptions { bumpMinorPreMajor?: boolean; + defaultBranch?: string; label?: string; token?: string; repoUrl: string; @@ -63,6 +64,7 @@ export class ReleasePR { static releaserName = 'base'; apiUrl: string; + defaultBranch?: string; labels: string[]; gh: GitHub; bumpMinorPreMajor?: boolean; @@ -76,6 +78,7 @@ export class ReleasePR { constructor(options: ReleasePROptions) { this.bumpMinorPreMajor = options.bumpMinorPreMajor || false; + this.defaultBranch = options.defaultBranch; this.labels = options.label ? options.label.split(',') : DEFAULT_LABELS.split(','); @@ -205,6 +208,7 @@ export class ReleasePR { const [owner, repo] = parseGithubRepoUrl(this.repoUrl); return new GitHub({ token: this.token, + defaultBranch: this.defaultBranch, owner, repo, apiUrl: this.apiUrl, diff --git a/test/fixtures/repo-get-1.json b/test/fixtures/repo-get-1.json new file mode 100644 index 000000000..66abcf9da --- /dev/null +++ b/test/fixtures/repo-get-1.json @@ -0,0 +1,362 @@ +{ + "id": 1296269, + "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", + "name": "Hello-World", + "full_name": "octocat/Hello-World", + "owner": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/octocat/Hello-World", + "description": "This your first repo!", + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World", + "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", + "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", + "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", + "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", + "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", + "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", + "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", + "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", + "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", + "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", + "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", + "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", + "events_url": "http://api.github.com/repos/octocat/Hello-World/events", + "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", + "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", + "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", + "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", + "git_url": "git:github.com/octocat/Hello-World.git", + "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", + "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", + "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", + "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", + "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", + "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", + "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", + "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", + "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", + "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", + "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", + "ssh_url": "git@github.com:octocat/Hello-World.git", + "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", + "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", + "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", + "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", + "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", + "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", + "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", + "clone_url": "https://github.com/octocat/Hello-World.git", + "mirror_url": "git:git.example.com/octocat/Hello-World", + "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", + "svn_url": "https://svn.github.com/octocat/Hello-World", + "homepage": "https://github.com", + "language": null, + "forks_count": 9, + "stargazers_count": 80, + "watchers_count": 80, + "size": 108, + "default_branch": "master", + "open_issues_count": 0, + "is_template": true, + "topics": [ + "octocat", + "atom", + "electron", + "api" + ], + "has_issues": true, + "has_projects": true, + "has_wiki": true, + "has_pages": false, + "has_downloads": true, + "archived": false, + "disabled": false, + "visibility": "public", + "pushed_at": "2011-01-26T19:06:43Z", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2011-01-26T19:14:43Z", + "permissions": { + "pull": true, + "triage": true, + "push": false, + "maintain": false, + "admin": false + }, + "allow_rebase_merge": true, + "template_repository": null, + "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", + "allow_squash_merge": true, + "delete_branch_on_merge": true, + "allow_merge_commit": true, + "subscribers_count": 42, + "network_count": 0, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZW1pdA==" + }, + "organization": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "Organization", + "site_admin": false + }, + "parent": { + "id": 1296269, + "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", + "name": "Hello-World", + "full_name": "octocat/Hello-World", + "owner": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/octocat/Hello-World", + "description": "This your first repo!", + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World", + "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", + "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", + "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", + "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", + "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", + "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", + "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", + "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", + "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", + "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", + "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", + "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", + "events_url": "http://api.github.com/repos/octocat/Hello-World/events", + "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", + "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", + "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", + "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", + "git_url": "git:github.com/octocat/Hello-World.git", + "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", + "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", + "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", + "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", + "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", + "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", + "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", + "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", + "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", + "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", + "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", + "ssh_url": "git@github.com:octocat/Hello-World.git", + "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", + "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", + "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", + "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", + "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", + "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", + "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", + "clone_url": "https://github.com/octocat/Hello-World.git", + "mirror_url": "git:git.example.com/octocat/Hello-World", + "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", + "svn_url": "https://svn.github.com/octocat/Hello-World", + "homepage": "https://github.com", + "language": null, + "forks_count": 9, + "stargazers_count": 80, + "watchers_count": 80, + "size": 108, + "default_branch": "master", + "open_issues_count": 0, + "is_template": true, + "topics": [ + "octocat", + "atom", + "electron", + "api" + ], + "has_issues": true, + "has_projects": true, + "has_wiki": true, + "has_pages": false, + "has_downloads": true, + "archived": false, + "disabled": false, + "visibility": "public", + "pushed_at": "2011-01-26T19:06:43Z", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2011-01-26T19:14:43Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "allow_rebase_merge": true, + "template_repository": null, + "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", + "allow_squash_merge": true, + "delete_branch_on_merge": true, + "allow_merge_commit": true, + "subscribers_count": 42, + "network_count": 0 + }, + "source": { + "id": 1296269, + "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", + "name": "Hello-World", + "full_name": "octocat/Hello-World", + "owner": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/octocat/Hello-World", + "description": "This your first repo!", + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World", + "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", + "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", + "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", + "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", + "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", + "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", + "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", + "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", + "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", + "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", + "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", + "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", + "events_url": "http://api.github.com/repos/octocat/Hello-World/events", + "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", + "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", + "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", + "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", + "git_url": "git:github.com/octocat/Hello-World.git", + "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", + "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", + "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", + "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", + "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", + "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", + "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", + "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", + "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", + "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", + "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", + "ssh_url": "git@github.com:octocat/Hello-World.git", + "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", + "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", + "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", + "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", + "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", + "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", + "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", + "clone_url": "https://github.com/octocat/Hello-World.git", + "mirror_url": "git:git.example.com/octocat/Hello-World", + "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", + "svn_url": "https://svn.github.com/octocat/Hello-World", + "homepage": "https://github.com", + "language": null, + "forks_count": 9, + "stargazers_count": 80, + "watchers_count": 80, + "size": 108, + "default_branch": "master", + "open_issues_count": 0, + "is_template": true, + "topics": [ + "octocat", + "atom", + "electron", + "api" + ], + "has_issues": true, + "has_projects": true, + "has_wiki": true, + "has_pages": false, + "has_downloads": true, + "archived": false, + "disabled": false, + "visibility": "public", + "pushed_at": "2011-01-26T19:06:43Z", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2011-01-26T19:14:43Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "allow_rebase_merge": true, + "template_repository": null, + "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", + "allow_squash_merge": true, + "delete_branch_on_merge": true, + "allow_merge_commit": true, + "subscribers_count": 42, + "network_count": 0 + } +} \ No newline at end of file diff --git a/test/fixtures/repo-get-2.json b/test/fixtures/repo-get-2.json new file mode 100644 index 000000000..b485cdb98 --- /dev/null +++ b/test/fixtures/repo-get-2.json @@ -0,0 +1,362 @@ +{ + "id": 1296269, + "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", + "name": "Hello-World", + "full_name": "octocat/Hello-World", + "owner": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/octocat/Hello-World", + "description": "This your first repo!", + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World", + "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", + "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", + "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", + "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", + "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", + "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", + "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", + "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", + "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", + "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", + "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", + "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", + "events_url": "http://api.github.com/repos/octocat/Hello-World/events", + "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", + "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", + "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", + "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", + "git_url": "git:github.com/octocat/Hello-World.git", + "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", + "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", + "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", + "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", + "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", + "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", + "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", + "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", + "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", + "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", + "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", + "ssh_url": "git@github.com:octocat/Hello-World.git", + "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", + "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", + "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", + "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", + "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", + "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", + "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", + "clone_url": "https://github.com/octocat/Hello-World.git", + "mirror_url": "git:git.example.com/octocat/Hello-World", + "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", + "svn_url": "https://svn.github.com/octocat/Hello-World", + "homepage": "https://github.com", + "language": null, + "forks_count": 9, + "stargazers_count": 80, + "watchers_count": 80, + "size": 108, + "default_branch": "main", + "open_issues_count": 0, + "is_template": true, + "topics": [ + "octocat", + "atom", + "electron", + "api" + ], + "has_issues": true, + "has_projects": true, + "has_wiki": true, + "has_pages": false, + "has_downloads": true, + "archived": false, + "disabled": false, + "visibility": "public", + "pushed_at": "2011-01-26T19:06:43Z", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2011-01-26T19:14:43Z", + "permissions": { + "pull": true, + "triage": true, + "push": false, + "maintain": false, + "admin": false + }, + "allow_rebase_merge": true, + "template_repository": null, + "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", + "allow_squash_merge": true, + "delete_branch_on_merge": true, + "allow_merge_commit": true, + "subscribers_count": 42, + "network_count": 0, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZW1pdA==" + }, + "organization": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "Organization", + "site_admin": false + }, + "parent": { + "id": 1296269, + "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", + "name": "Hello-World", + "full_name": "octocat/Hello-World", + "owner": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/octocat/Hello-World", + "description": "This your first repo!", + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World", + "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", + "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", + "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", + "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", + "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", + "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", + "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", + "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", + "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", + "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", + "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", + "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", + "events_url": "http://api.github.com/repos/octocat/Hello-World/events", + "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", + "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", + "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", + "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", + "git_url": "git:github.com/octocat/Hello-World.git", + "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", + "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", + "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", + "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", + "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", + "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", + "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", + "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", + "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", + "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", + "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", + "ssh_url": "git@github.com:octocat/Hello-World.git", + "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", + "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", + "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", + "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", + "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", + "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", + "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", + "clone_url": "https://github.com/octocat/Hello-World.git", + "mirror_url": "git:git.example.com/octocat/Hello-World", + "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", + "svn_url": "https://svn.github.com/octocat/Hello-World", + "homepage": "https://github.com", + "language": null, + "forks_count": 9, + "stargazers_count": 80, + "watchers_count": 80, + "size": 108, + "default_branch": "main", + "open_issues_count": 0, + "is_template": true, + "topics": [ + "octocat", + "atom", + "electron", + "api" + ], + "has_issues": true, + "has_projects": true, + "has_wiki": true, + "has_pages": false, + "has_downloads": true, + "archived": false, + "disabled": false, + "visibility": "public", + "pushed_at": "2011-01-26T19:06:43Z", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2011-01-26T19:14:43Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "allow_rebase_merge": true, + "template_repository": null, + "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", + "allow_squash_merge": true, + "delete_branch_on_merge": true, + "allow_merge_commit": true, + "subscribers_count": 42, + "network_count": 0 + }, + "source": { + "id": 1296269, + "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", + "name": "Hello-World", + "full_name": "octocat/Hello-World", + "owner": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/octocat/Hello-World", + "description": "This your first repo!", + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World", + "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", + "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", + "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", + "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", + "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", + "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", + "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", + "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", + "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", + "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", + "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", + "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", + "events_url": "http://api.github.com/repos/octocat/Hello-World/events", + "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", + "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", + "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", + "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", + "git_url": "git:github.com/octocat/Hello-World.git", + "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", + "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", + "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", + "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", + "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", + "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", + "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", + "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", + "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", + "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", + "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", + "ssh_url": "git@github.com:octocat/Hello-World.git", + "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", + "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", + "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", + "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", + "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", + "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", + "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", + "clone_url": "https://github.com/octocat/Hello-World.git", + "mirror_url": "git:git.example.com/octocat/Hello-World", + "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", + "svn_url": "https://svn.github.com/octocat/Hello-World", + "homepage": "https://github.com", + "language": null, + "forks_count": 9, + "stargazers_count": 80, + "watchers_count": 80, + "size": 108, + "default_branch": "main", + "open_issues_count": 0, + "is_template": true, + "topics": [ + "octocat", + "atom", + "electron", + "api" + ], + "has_issues": true, + "has_projects": true, + "has_wiki": true, + "has_pages": false, + "has_downloads": true, + "archived": false, + "disabled": false, + "visibility": "public", + "pushed_at": "2011-01-26T19:06:43Z", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2011-01-26T19:14:43Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "allow_rebase_merge": true, + "template_repository": null, + "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", + "allow_squash_merge": true, + "delete_branch_on_merge": true, + "allow_merge_commit": true, + "subscribers_count": 42, + "network_count": 0 + } + } \ No newline at end of file diff --git a/test/release-pr-factory.ts b/test/release-pr-factory.ts index 3bb9d6132..8e5ae66d1 100644 --- a/test/release-pr-factory.ts +++ b/test/release-pr-factory.ts @@ -99,15 +99,16 @@ describe('ReleasePRFactory', () => { } ) .reply(200) + // check for default branch + .get('/repos/googleapis/simple-test-repo') + // eslint-disable-next-line @typescript-eslint/no-var-requires + .reply(200, require('../../test/fixtures/repo-get-2.json')) // create release .post( '/repos/googleapis/simple-test-repo/pulls', (req: {[key: string]: string}) => { - const body = req.body.replace( - /\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, - '' - ); - snapshot(body); + req.body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); + snapshot(req); return true; } ) @@ -207,15 +208,16 @@ describe('ReleasePRFactory', () => { } ) .reply(200) + // check for default branch + .get('/repos/googleapis/simple-test-repo') + // eslint-disable-next-line @typescript-eslint/no-var-requires + .reply(200, require('../../test/fixtures/repo-get-2.json')) // create release .post( '/repos/googleapis/simple-test-repo/pulls', (req: {[key: string]: string}) => { - const body = req.body.replace( - /\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, - '' - ); - snapshot(body); + req.body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); + snapshot(req); return true; } ) diff --git a/test/release-pr.ts b/test/release-pr.ts index 965b8e2d3..2fc65ad74 100644 --- a/test/release-pr.ts +++ b/test/release-pr.ts @@ -203,16 +203,17 @@ describe('GitHub', () => { .reply(200, []) .put('/repos/googleapis/release-please/contents/CHANGELOG.md') .reply(200, []) + // check for default branch + .get('/repos/googleapis/release-please') + // eslint-disable-next-line @typescript-eslint/no-var-requires + .reply(200, require('../../test/fixtures/repo-get-1.json')) // actually open the darn PR, this is the exciting step, // so we snapshot it: .post( '/repos/googleapis/release-please/pulls', (req: {[key: string]: string}) => { - const body = req.body.replace( - /\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, - '' - ); - snapshot(body); + req.body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); + snapshot(req); return true; } ) diff --git a/test/releasers/java-bom.ts b/test/releasers/java-bom.ts index c970237a2..4d8bf027d 100644 --- a/test/releasers/java-bom.ts +++ b/test/releasers/java-bom.ts @@ -163,15 +163,16 @@ describe('JavaBom', () => { } ) .reply(200) + // check for default branch + .get('/repos/googleapis/java-cloud-bom') + // eslint-disable-next-line @typescript-eslint/no-var-requires + .reply(200, require('../../../test/fixtures/repo-get-2.json')) // create release .post( '/repos/googleapis/java-cloud-bom/pulls', (req: {[key: string]: string}) => { - const body = req.body.replace( - /\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, - '' - ); - snapshot('PR body-bom', body); + req.body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); + snapshot('PR body-bom', req); return true; } ) @@ -285,15 +286,16 @@ describe('JavaBom', () => { } ) .reply(200) + // check for default branch + .get('/repos/googleapis/java-cloud-bom') + // eslint-disable-next-line @typescript-eslint/no-var-requires + .reply(200, require('../../../test/fixtures/repo-get-2.json')) // create release .post( '/repos/googleapis/java-cloud-bom/pulls', (req: {[key: string]: string}) => { - const body = req.body.replace( - /\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, - '' - ); - snapshot('PR body-bom-snapshot', body); + req.body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); + snapshot('PR body-bom-snapshot', req); return true; } ) @@ -446,15 +448,16 @@ describe('JavaBom', () => { } ) .reply(200) + // check for default branch + .get('/repos/googleapis/java-cloud-bom') + // eslint-disable-next-line @typescript-eslint/no-var-requires + .reply(200, require('../../../test/fixtures/repo-get-1.json')) // create release .post( '/repos/googleapis/java-cloud-bom/pulls', (req: {[key: string]: string}) => { - const body = req.body.replace( - /\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, - '' - ); - snapshot('PR body-bom-feature', body); + req.body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); + snapshot('PR body-bom-feature', req); return true; } ) diff --git a/test/releasers/java-yoshi.ts b/test/releasers/java-yoshi.ts index 0650580a7..ad0d95a85 100644 --- a/test/releasers/java-yoshi.ts +++ b/test/releasers/java-yoshi.ts @@ -198,12 +198,16 @@ describe('JavaYoshi', () => { } ) .reply(200) + // check for default branch + .get('/repos/googleapis/java-trace') + // eslint-disable-next-line @typescript-eslint/no-var-requires + .reply(200, require('../../../test/fixtures/repo-get-1.json')) // create release .post( '/repos/googleapis/java-trace/pulls', (req: {[key: string]: string}) => { - const body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); - snapshot('PR body', body); + req.body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); + snapshot('PR body', req); return true; } ) @@ -328,12 +332,16 @@ describe('JavaYoshi', () => { } ) .reply(200) + // check for default branch + .get('/repos/googleapis/java-trace') + // eslint-disable-next-line @typescript-eslint/no-var-requires + .reply(200, require('../../../test/fixtures/repo-get-2.json')) // create release .post( '/repos/googleapis/java-trace/pulls', (req: {[key: string]: string}) => { - const body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); - snapshot('PR body-snapshot', body); + req.body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); + snapshot('PR body-snapshot', req); return true; } ) diff --git a/test/releasers/simple.ts b/test/releasers/simple.ts index 73480eee8..bc0811af0 100644 --- a/test/releasers/simple.ts +++ b/test/releasers/simple.ts @@ -112,15 +112,16 @@ describe('Simple', () => { } ) .reply(200) + // check for default branch + .get('/repos/googleapis/simple-test-repo') + // eslint-disable-next-line @typescript-eslint/no-var-requires + .reply(200, require('../../../test/fixtures/repo-get-1.json')) // create release .post( '/repos/googleapis/simple-test-repo/pulls', (req: {[key: string]: string}) => { - const body = req.body.replace( - /\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, - '' - ); - snapshot('PR body-simple', body); + req.body = req.body.replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, ''); + snapshot('PR body-simple', req); return true; } )