Fix: don't try to migrate cms prs from forks (#3331)
This commit is contained in:
parent
908c42fb58
commit
3e873f3e02
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -361,7 +361,7 @@
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms?ts=300",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms/forkOwner/repo?ts=300",
|
||||
"headers": {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
@ -992,4 +992,4 @@
|
||||
"response": "{\n \"state\": \"pending\",\n \"statuses\": [\n\n ],\n \"sha\": \"89cd642999af7e9da352bdfdd792703160d01f5a\",\n \"total_count\": 0,\n \"repository\": {\n \"id\": 242194325,\n \"node_id\": \"MDEwOlJlcG9zaXRvcnkyNDIxOTQzMjU=\",\n \"name\": \"repo\",\n \"full_name\": \"owner/repo\",\n \"private\": false,\n \"owner\": {\n \"login\": \"owner\",\n \"id\": 26760571,\n \"node_id\": \"MDQ6VXNlcjI2NzYwNTcx\",\n \"avatar_url\": \"https://avatars1.githubusercontent.com/u/7892489?v=4\",\n \"gravatar_id\": \"\",\n \"url\": \"https://api.github.com/users/owner\",\n \"html_url\": \"https://github.com/owner\",\n \"followers_url\": \"https://api.github.com/users/owner/followers\",\n \"following_url\": \"https://api.github.com/users/owner/following{/other_user}\",\n \"gists_url\": \"https://api.github.com/users/owner/gists{/gist_id}\",\n \"starred_url\": \"https://api.github.com/users/owner/starred{/owner}{/repo}\",\n \"subscriptions_url\": \"https://api.github.com/users/owner/subscriptions\",\n \"organizations_url\": \"https://api.github.com/users/owner/orgs\",\n \"repos_url\": \"https://api.github.com/users/owner/repos\",\n \"events_url\": \"https://api.github.com/users/owner/events{/privacy}\",\n \"received_events_url\": \"https://api.github.com/users/owner/received_events\",\n \"type\": \"User\",\n \"site_admin\": false\n },\n \"html_url\": \"https://github.com/owner/repo\",\n \"description\": null,\n \"fork\": false,\n \"url\": \"https://api.github.com/repos/owner/repo\",\n \"forks_url\": \"https://api.github.com/repos/owner/repo/forks\",\n \"keys_url\": \"https://api.github.com/repos/owner/repo/keys{/key_id}\",\n \"collaborators_url\": \"https://api.github.com/repos/owner/repo/collaborators{/collaborator}\",\n \"teams_url\": \"https://api.github.com/repos/owner/repo/teams\",\n \"hooks_url\": \"https://api.github.com/repos/owner/repo/hooks\",\n \"issue_events_url\": \"https://api.github.com/repos/owner/repo/issues/events{/number}\",\n \"events_url\": \"https://api.github.com/repos/owner/repo/events\",\n \"assignees_url\": \"https://api.github.com/repos/owner/repo/assignees{/user}\",\n \"branches_url\": \"https://api.github.com/repos/owner/repo/branches{/branch}\",\n \"tags_url\": \"https://api.github.com/repos/owner/repo/tags\",\n \"blobs_url\": \"https://api.github.com/repos/owner/repo/git/blobs{/sha}\",\n \"git_tags_url\": \"https://api.github.com/repos/owner/repo/git/tags{/sha}\",\n \"git_refs_url\": \"https://api.github.com/repos/owner/repo/git/refs{/sha}\",\n \"trees_url\": \"https://api.github.com/repos/owner/repo/git/trees{/sha}\",\n \"statuses_url\": \"https://api.github.com/repos/owner/repo/statuses/{sha}\",\n \"languages_url\": \"https://api.github.com/repos/owner/repo/languages\",\n \"stargazers_url\": \"https://api.github.com/repos/owner/repo/stargazers\",\n \"contributors_url\": \"https://api.github.com/repos/owner/repo/contributors\",\n \"subscribers_url\": \"https://api.github.com/repos/owner/repo/subscribers\",\n \"subscription_url\": \"https://api.github.com/repos/owner/repo/subscription\",\n \"commits_url\": \"https://api.github.com/repos/owner/repo/commits{/sha}\",\n \"git_commits_url\": \"https://api.github.com/repos/owner/repo/git/commits{/sha}\",\n \"comments_url\": \"https://api.github.com/repos/owner/repo/comments{/number}\",\n \"issue_comment_url\": \"https://api.github.com/repos/owner/repo/issues/comments{/number}\",\n \"contents_url\": \"https://api.github.com/repos/owner/repo/contents/{+path}\",\n \"compare_url\": \"https://api.github.com/repos/owner/repo/compare/{base}...{head}\",\n \"merges_url\": \"https://api.github.com/repos/owner/repo/merges\",\n \"archive_url\": \"https://api.github.com/repos/owner/repo/{archive_format}{/ref}\",\n \"downloads_url\": \"https://api.github.com/repos/owner/repo/downloads\",\n \"issues_url\": \"https://api.github.com/repos/owner/repo/issues{/number}\",\n \"pulls_url\": \"https://api.github.com/repos/owner/repo/pulls{/number}\",\n \"milestones_url\": \"https://api.github.com/repos/owner/repo/milestones{/number}\",\n \"notifications_url\": \"https://api.github.com/repos/owner/repo/notifications{?since,all,participating}\",\n \"labels_url\": \"https://api.github.com/repos/owner/repo/labels{/name}\",\n \"releases_url\": \"https://api.github.com/repos/owner/repo/releases{/id}\",\n \"deployments_url\": \"https://api.github.com/repos/owner/repo/deployments\"\n },\n \"commit_url\": \"https://api.github.com/repos/owner/repo/commits/89cd642999af7e9da352bdfdd792703160d01f5a\",\n \"url\": \"https://api.github.com/repos/owner/repo/commits/89cd642999af7e9da352bdfdd792703160d01f5a/status\"\n}\n",
|
||||
"status": 200
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -388,7 +388,7 @@
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms?ts=300",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms/forkOwner/repo?ts=300",
|
||||
"headers": {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
@ -809,4 +809,4 @@
|
||||
"response": "{\n \"state\": \"pending\",\n \"statuses\": [\n\n ],\n \"sha\": \"dccdcb397cda0c05b4467c9c438d26a11a84081f\",\n \"total_count\": 0,\n \"repository\": {\n \"id\": 242187005,\n \"node_id\": \"MDEwOlJlcG9zaXRvcnkyNDIxODcwMDU=\",\n \"name\": \"repo\",\n \"full_name\": \"owner/repo\",\n \"private\": false,\n \"owner\": {\n \"login\": \"owner\",\n \"id\": 26760571,\n \"node_id\": \"MDQ6VXNlcjI2NzYwNTcx\",\n \"avatar_url\": \"https://avatars1.githubusercontent.com/u/7892489?v=4\",\n \"gravatar_id\": \"\",\n \"url\": \"https://api.github.com/users/owner\",\n \"html_url\": \"https://github.com/owner\",\n \"followers_url\": \"https://api.github.com/users/owner/followers\",\n \"following_url\": \"https://api.github.com/users/owner/following{/other_user}\",\n \"gists_url\": \"https://api.github.com/users/owner/gists{/gist_id}\",\n \"starred_url\": \"https://api.github.com/users/owner/starred{/owner}{/repo}\",\n \"subscriptions_url\": \"https://api.github.com/users/owner/subscriptions\",\n \"organizations_url\": \"https://api.github.com/users/owner/orgs\",\n \"repos_url\": \"https://api.github.com/users/owner/repos\",\n \"events_url\": \"https://api.github.com/users/owner/events{/privacy}\",\n \"received_events_url\": \"https://api.github.com/users/owner/received_events\",\n \"type\": \"User\",\n \"site_admin\": false\n },\n \"html_url\": \"https://github.com/owner/repo\",\n \"description\": null,\n \"fork\": false,\n \"url\": \"https://api.github.com/repos/owner/repo\",\n \"forks_url\": \"https://api.github.com/repos/owner/repo/forks\",\n \"keys_url\": \"https://api.github.com/repos/owner/repo/keys{/key_id}\",\n \"collaborators_url\": \"https://api.github.com/repos/owner/repo/collaborators{/collaborator}\",\n \"teams_url\": \"https://api.github.com/repos/owner/repo/teams\",\n \"hooks_url\": \"https://api.github.com/repos/owner/repo/hooks\",\n \"issue_events_url\": \"https://api.github.com/repos/owner/repo/issues/events{/number}\",\n \"events_url\": \"https://api.github.com/repos/owner/repo/events\",\n \"assignees_url\": \"https://api.github.com/repos/owner/repo/assignees{/user}\",\n \"branches_url\": \"https://api.github.com/repos/owner/repo/branches{/branch}\",\n \"tags_url\": \"https://api.github.com/repos/owner/repo/tags\",\n \"blobs_url\": \"https://api.github.com/repos/owner/repo/git/blobs{/sha}\",\n \"git_tags_url\": \"https://api.github.com/repos/owner/repo/git/tags{/sha}\",\n \"git_refs_url\": \"https://api.github.com/repos/owner/repo/git/refs{/sha}\",\n \"trees_url\": \"https://api.github.com/repos/owner/repo/git/trees{/sha}\",\n \"statuses_url\": \"https://api.github.com/repos/owner/repo/statuses/{sha}\",\n \"languages_url\": \"https://api.github.com/repos/owner/repo/languages\",\n \"stargazers_url\": \"https://api.github.com/repos/owner/repo/stargazers\",\n \"contributors_url\": \"https://api.github.com/repos/owner/repo/contributors\",\n \"subscribers_url\": \"https://api.github.com/repos/owner/repo/subscribers\",\n \"subscription_url\": \"https://api.github.com/repos/owner/repo/subscription\",\n \"commits_url\": \"https://api.github.com/repos/owner/repo/commits{/sha}\",\n \"git_commits_url\": \"https://api.github.com/repos/owner/repo/git/commits{/sha}\",\n \"comments_url\": \"https://api.github.com/repos/owner/repo/comments{/number}\",\n \"issue_comment_url\": \"https://api.github.com/repos/owner/repo/issues/comments{/number}\",\n \"contents_url\": \"https://api.github.com/repos/owner/repo/contents/{+path}\",\n \"compare_url\": \"https://api.github.com/repos/owner/repo/compare/{base}...{head}\",\n \"merges_url\": \"https://api.github.com/repos/owner/repo/merges\",\n \"archive_url\": \"https://api.github.com/repos/owner/repo/{archive_format}{/ref}\",\n \"downloads_url\": \"https://api.github.com/repos/owner/repo/downloads\",\n \"issues_url\": \"https://api.github.com/repos/owner/repo/issues{/number}\",\n \"pulls_url\": \"https://api.github.com/repos/owner/repo/pulls{/number}\",\n \"milestones_url\": \"https://api.github.com/repos/owner/repo/milestones{/number}\",\n \"notifications_url\": \"https://api.github.com/repos/owner/repo/notifications{?since,all,participating}\",\n \"labels_url\": \"https://api.github.com/repos/owner/repo/labels{/name}\",\n \"releases_url\": \"https://api.github.com/repos/owner/repo/releases{/id}\",\n \"deployments_url\": \"https://api.github.com/repos/owner/repo/deployments\"\n },\n \"commit_url\": \"https://api.github.com/repos/owner/repo/commits/dccdcb397cda0c05b4467c9c438d26a11a84081f\",\n \"url\": \"https://api.github.com/repos/owner/repo/commits/dccdcb397cda0c05b4467c9c438d26a11a84081f/status\"\n}\n",
|
||||
"status": 200
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -362,7 +362,7 @@
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms?ts=300",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms/forkOwner/repo?ts=300",
|
||||
"headers": {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
@ -1069,4 +1069,4 @@
|
||||
"response": "{\n \"message\": \"Branch not found\",\n \"documentation_url\": \"https://developer.github.com/v3/repos/branches/#get-branch\"\n}\n",
|
||||
"status": 404
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -388,7 +388,7 @@
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms?ts=300",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms/forkOwner/repo?ts=300",
|
||||
"headers": {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
@ -1201,4 +1201,4 @@
|
||||
"response": null,
|
||||
"status": 204
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -388,7 +388,7 @@
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms?ts=300",
|
||||
"url": "/repos/forkOwner/repo/git/refs/heads/cms/forkOwner/repo?ts=300",
|
||||
"headers": {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Server": "GitHub.com",
|
||||
@ -1700,4 +1700,4 @@
|
||||
"response": "{\n \"state\": \"pending\",\n \"statuses\": [\n\n ],\n \"sha\": \"7df12929d6ead77820cc3f4b07d4aef810390774\",\n \"total_count\": 0,\n \"repository\": {\n \"id\": 242187005,\n \"node_id\": \"MDEwOlJlcG9zaXRvcnkyNDIxODcwMDU=\",\n \"name\": \"repo\",\n \"full_name\": \"owner/repo\",\n \"private\": false,\n \"owner\": {\n \"login\": \"owner\",\n \"id\": 26760571,\n \"node_id\": \"MDQ6VXNlcjI2NzYwNTcx\",\n \"avatar_url\": \"https://avatars1.githubusercontent.com/u/7892489?v=4\",\n \"gravatar_id\": \"\",\n \"url\": \"https://api.github.com/users/owner\",\n \"html_url\": \"https://github.com/owner\",\n \"followers_url\": \"https://api.github.com/users/owner/followers\",\n \"following_url\": \"https://api.github.com/users/owner/following{/other_user}\",\n \"gists_url\": \"https://api.github.com/users/owner/gists{/gist_id}\",\n \"starred_url\": \"https://api.github.com/users/owner/starred{/owner}{/repo}\",\n \"subscriptions_url\": \"https://api.github.com/users/owner/subscriptions\",\n \"organizations_url\": \"https://api.github.com/users/owner/orgs\",\n \"repos_url\": \"https://api.github.com/users/owner/repos\",\n \"events_url\": \"https://api.github.com/users/owner/events{/privacy}\",\n \"received_events_url\": \"https://api.github.com/users/owner/received_events\",\n \"type\": \"User\",\n \"site_admin\": false\n },\n \"html_url\": \"https://github.com/owner/repo\",\n \"description\": null,\n \"fork\": false,\n \"url\": \"https://api.github.com/repos/owner/repo\",\n \"forks_url\": \"https://api.github.com/repos/owner/repo/forks\",\n \"keys_url\": \"https://api.github.com/repos/owner/repo/keys{/key_id}\",\n \"collaborators_url\": \"https://api.github.com/repos/owner/repo/collaborators{/collaborator}\",\n \"teams_url\": \"https://api.github.com/repos/owner/repo/teams\",\n \"hooks_url\": \"https://api.github.com/repos/owner/repo/hooks\",\n \"issue_events_url\": \"https://api.github.com/repos/owner/repo/issues/events{/number}\",\n \"events_url\": \"https://api.github.com/repos/owner/repo/events\",\n \"assignees_url\": \"https://api.github.com/repos/owner/repo/assignees{/user}\",\n \"branches_url\": \"https://api.github.com/repos/owner/repo/branches{/branch}\",\n \"tags_url\": \"https://api.github.com/repos/owner/repo/tags\",\n \"blobs_url\": \"https://api.github.com/repos/owner/repo/git/blobs{/sha}\",\n \"git_tags_url\": \"https://api.github.com/repos/owner/repo/git/tags{/sha}\",\n \"git_refs_url\": \"https://api.github.com/repos/owner/repo/git/refs{/sha}\",\n \"trees_url\": \"https://api.github.com/repos/owner/repo/git/trees{/sha}\",\n \"statuses_url\": \"https://api.github.com/repos/owner/repo/statuses/{sha}\",\n \"languages_url\": \"https://api.github.com/repos/owner/repo/languages\",\n \"stargazers_url\": \"https://api.github.com/repos/owner/repo/stargazers\",\n \"contributors_url\": \"https://api.github.com/repos/owner/repo/contributors\",\n \"subscribers_url\": \"https://api.github.com/repos/owner/repo/subscribers\",\n \"subscription_url\": \"https://api.github.com/repos/owner/repo/subscription\",\n \"commits_url\": \"https://api.github.com/repos/owner/repo/commits{/sha}\",\n \"git_commits_url\": \"https://api.github.com/repos/owner/repo/git/commits{/sha}\",\n \"comments_url\": \"https://api.github.com/repos/owner/repo/comments{/number}\",\n \"issue_comment_url\": \"https://api.github.com/repos/owner/repo/issues/comments{/number}\",\n \"contents_url\": \"https://api.github.com/repos/owner/repo/contents/{+path}\",\n \"compare_url\": \"https://api.github.com/repos/owner/repo/compare/{base}...{head}\",\n \"merges_url\": \"https://api.github.com/repos/owner/repo/merges\",\n \"archive_url\": \"https://api.github.com/repos/owner/repo/{archive_format}{/ref}\",\n \"downloads_url\": \"https://api.github.com/repos/owner/repo/downloads\",\n \"issues_url\": \"https://api.github.com/repos/owner/repo/issues{/number}\",\n \"pulls_url\": \"https://api.github.com/repos/owner/repo/pulls{/number}\",\n \"milestones_url\": \"https://api.github.com/repos/owner/repo/milestones{/number}\",\n \"notifications_url\": \"https://api.github.com/repos/owner/repo/notifications{?since,all,participating}\",\n \"labels_url\": \"https://api.github.com/repos/owner/repo/labels{/name}\",\n \"releases_url\": \"https://api.github.com/repos/owner/repo/releases{/id}\",\n \"deployments_url\": \"https://api.github.com/repos/owner/repo/deployments\"\n },\n \"commit_url\": \"https://api.github.com/repos/owner/repo/commits/7df12929d6ead77820cc3f4b07d4aef810390774\",\n \"url\": \"https://api.github.com/repos/owner/repo/commits/7df12929d6ead77820cc3f4b07d4aef810390774/status\"\n}\n",
|
||||
"status": 200
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -5,7 +5,7 @@ import { entry1, entry2, entry3 } from './common/entries';
|
||||
const backend = 'github';
|
||||
|
||||
describe('Github Backend Editorial Workflow - GraphQL API', () => {
|
||||
let taskResult = { data: {} };
|
||||
const taskResult = { data: {} };
|
||||
|
||||
before(() => {
|
||||
specUtils.before(
|
||||
|
@ -5,7 +5,7 @@ import { entry1, entry2, entry3 } from './common/entries';
|
||||
const backend = 'github';
|
||||
|
||||
describe('Github Backend Editorial Workflow - GraphQL API - Open Authoring', () => {
|
||||
let taskResult = { data: {} };
|
||||
const taskResult = { data: {} };
|
||||
|
||||
before(() => {
|
||||
specUtils.before(
|
||||
|
@ -5,7 +5,7 @@ import * as specUtils from './common/spec_utils';
|
||||
const backend = 'github';
|
||||
|
||||
describe('GitHub Backend Media Library - GraphQL API', () => {
|
||||
let taskResult = { data: {} };
|
||||
const taskResult = { data: {} };
|
||||
|
||||
before(() => {
|
||||
specUtils.before(
|
||||
|
@ -5,7 +5,7 @@ import { entry1, entry2, entry3 } from './common/entries';
|
||||
const backend = 'github';
|
||||
|
||||
describe('GitHub Backend Simple Workflow - GraphQL API', () => {
|
||||
let taskResult = { data: {} };
|
||||
const taskResult = { data: {} };
|
||||
|
||||
before(() => {
|
||||
specUtils.before(
|
||||
|
@ -287,7 +287,10 @@ const sanitizeString = (
|
||||
.replace(new RegExp(escapeRegExp(owner), 'g'), GITHUB_REPO_OWNER_SANITIZED_VALUE)
|
||||
.replace(new RegExp(escapeRegExp(repo), 'g'), GITHUB_REPO_NAME_SANITIZED_VALUE)
|
||||
.replace(new RegExp(escapeRegExp(token), 'g'), GITHUB_REPO_TOKEN_SANITIZED_VALUE)
|
||||
.replace(new RegExp('https://avatars.+?/u/.+?v=\\d', 'g'), `${FAKE_OWNER_USER.avatar_url}`);
|
||||
.replace(
|
||||
new RegExp('https://avatars\\d+\\.githubusercontent\\.com/u/\\d+?\\?v=\\d', 'g'),
|
||||
`${FAKE_OWNER_USER.avatar_url}`,
|
||||
);
|
||||
|
||||
if (ownerName) {
|
||||
replaced = replaced.replace(new RegExp(escapeRegExp(ownerName), 'g'), FAKE_OWNER_USER.name);
|
||||
|
@ -719,6 +719,7 @@ export default class API {
|
||||
let metadata = await this.retrieveMetadataOld(contentKey).catch(() => undefined);
|
||||
|
||||
if (!metadata) {
|
||||
console.log(`Skipped migrating Pull Request '${number}' (${countMessage})`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -753,9 +754,9 @@ export default class API {
|
||||
);
|
||||
}
|
||||
|
||||
async getCmsBranches() {
|
||||
async getOpenAuthoringBranches() {
|
||||
const cmsBranches = await this.requestAllPages<Octokit.GitListMatchingRefsResponseItem>(
|
||||
`${this.repoURL}/git/refs/heads/cms`,
|
||||
`${this.repoURL}/git/refs/heads/cms/${this.repo}`,
|
||||
).catch(() => [] as Octokit.GitListMatchingRefsResponseItem[]);
|
||||
return cmsBranches;
|
||||
}
|
||||
@ -769,7 +770,7 @@ export default class API {
|
||||
let branches: string[];
|
||||
if (this.useOpenAuthoring) {
|
||||
// open authoring branches can exist without a pr
|
||||
const cmsBranches: Octokit.GitListMatchingRefsResponse = await this.getCmsBranches();
|
||||
const cmsBranches: Octokit.GitListMatchingRefsResponse = await this.getOpenAuthoringBranches();
|
||||
branches = cmsBranches.map(b => b.ref.substring('refs/heads/'.length));
|
||||
// filter irrelevant branches
|
||||
const branchesWithFilter = await Promise.all(
|
||||
@ -781,7 +782,7 @@ export default class API {
|
||||
const pullRequests = await this.getPullRequests(
|
||||
undefined,
|
||||
PullRequestState.Open,
|
||||
withoutCmsLabel,
|
||||
pr => !pr.head.repo.fork && withoutCmsLabel(pr),
|
||||
);
|
||||
let prCount = 0;
|
||||
for (const pr of pullRequests) {
|
||||
|
@ -62,13 +62,17 @@ type GraphQLPullRequest = {
|
||||
title: string;
|
||||
mergedAt: string | null;
|
||||
labels: { nodes: { name: string }[] };
|
||||
repository: {
|
||||
id: string;
|
||||
isFork: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
const transformPullRequest = (pr: GraphQLPullRequest) => {
|
||||
return {
|
||||
...pr,
|
||||
labels: pr.labels.nodes,
|
||||
head: { ref: pr.headRefName, sha: pr.headRefOid },
|
||||
head: { ref: pr.headRefName, sha: pr.headRefOid, repo: { fork: pr.repository.isFork } },
|
||||
base: { ref: pr.baseRefName, sha: pr.baseRefOid },
|
||||
};
|
||||
};
|
||||
@ -266,13 +270,14 @@ export default class GraphQLAPI extends API {
|
||||
);
|
||||
}
|
||||
|
||||
async getCmsBranches() {
|
||||
async getOpenAuthoringBranches() {
|
||||
const { repoOwner: owner, repoName: name } = this;
|
||||
const { data } = await this.query({
|
||||
query: queries.cmsBranches,
|
||||
query: queries.openAuthoringBranches,
|
||||
variables: {
|
||||
owner,
|
||||
name,
|
||||
refPrefix: `refs/heads/cms/${this.repo}/`,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -3,6 +3,7 @@ import gql from 'graphql-tag';
|
||||
export const repository = gql`
|
||||
fragment RepositoryParts on Repository {
|
||||
id
|
||||
isFork
|
||||
}
|
||||
`;
|
||||
|
||||
|
@ -126,11 +126,11 @@ export const branch = gql`
|
||||
${fragments.branch}
|
||||
`;
|
||||
|
||||
export const cmsBranches = gql`
|
||||
query cmsBranches($owner: String!, $name: String!) {
|
||||
export const openAuthoringBranches = gql`
|
||||
query openAuthoringBranches($owner: String!, $name: String!, $refPrefix: String!) {
|
||||
repository(owner: $owner, name: $name) {
|
||||
...RepositoryParts
|
||||
refs(refPrefix: "refs/heads/cms/", last: 100) {
|
||||
refs(refPrefix: $refPrefix, last: 100) {
|
||||
nodes {
|
||||
...BranchParts
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user