Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions api/lib/get-state-with-project-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ export async function getStateWithProjectFields(project, state) {
number: project.number,
});

if (
response.userOrOrganization === null ||
response.userOrOrganization.projectV2 === null
) {
throw new Error(
`[github-project] Cannot find project with number: ${project.number} and owner: ${project.owner}`
);
}

const {
userOrOrganization: { projectV2 },
} = response;
Expand Down
1 change: 1 addition & 0 deletions api/lib/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const queryIssuesAndPullRequestNodes = `
}
}
closed
closedAt
milestone {
number
title
Expand Down
28 changes: 14 additions & 14 deletions test/recorded/api.getProperties-field-not-found/fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"query": "\n query getProjectCoreData($owner: String!, $number: Int!) {\n userOrOrganization: repositoryOwner(login: $owner) {\n ... on ProjectV2Owner {\n projectV2(number: $number) {\n \n id\n title\n url\n databaseId\n fields(first: 50) {\n nodes {\n ... on ProjectV2FieldCommon {\n id\n dataType\n name\n }\n ... on ProjectV2SingleSelectField {\n options {\n id\n name\n }\n }\n ... on ProjectV2IterationField {\n configuration {\n iterations {\n title\n duration\n startDate\n }\n completedIterations {\n title\n duration\n startDate\n }\n duration\n startDay\n }\n }\n }\n }\n\n }\n }\n }\n }\n",
"variables": {
"owner": "github-project-fixtures",
"number": 6
"number": 2
},
"response": {
"status": 200,
Expand All @@ -15,7 +15,7 @@
"content-encoding": "gzip",
"content-security-policy": "default-src 'none'",
"content-type": "application/json; charset=utf-8",
"date": "Mon, 13 Feb 2023 19:41:17 GMT",
"date": "Sat, 20 May 2023 00:15:08 GMT",
"referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"server": "GitHub.com",
"strict-transport-security": "max-age=31536000; includeSubdomains; preload",
Expand All @@ -24,21 +24,21 @@
"x-content-type-options": "nosniff",
"x-frame-options": "deny",
"x-github-media-type": "github.v3; format=json",
"x-github-request-id": "D662:5EF5:4BD76F8:9CE8ECC:63EA925D",
"x-github-request-id": "E536:8FBC:4D8880B:4FED5E6:6468110C",
"x-ratelimit-limit": "5000",
"x-ratelimit-remaining": "4988",
"x-ratelimit-reset": "1676319618",
"x-ratelimit-remaining": "4992",
"x-ratelimit-reset": "1684545298",
"x-ratelimit-resource": "graphql",
"x-ratelimit-used": "12",
"x-ratelimit-used": "8",
"x-xss-protection": "0"
},
"data": {
"data": {
"userOrOrganization": {
"projectV2": {
"id": "PVT_1",
"title": "@tmelliottjrs Test Fixtures",
"url": "https://github.com/orgs/github-project-fixtures/projects/6",
"title": "@gr2m's Test Fixtures",
"url": "https://github.com/orgs/github-project-fixtures/projects/2",
"databaseId": 1001,
"fields": {
"nodes": [
Expand All @@ -58,15 +58,15 @@
"name": "Status",
"options": [
{
"id": "a57b7c0b",
"id": "f75ad846",
"name": "Todo"
},
{
"id": "e5a5bc6d",
"id": "47fc9ee4",
"name": "In Progress"
},
{
"id": "7eb1a684",
"id": "98236657",
"name": "Done"
}
]
Expand Down Expand Up @@ -117,15 +117,15 @@
"name": "Single select",
"options": [
{
"id": "c35f8785",
"id": "b92ebdaa",
"name": "One"
},
{
"id": "7390103a",
"id": "8a0f266e",
"name": "Two"
},
{
"id": "cbba01c9",
"id": "7ec185b4",
"name": "Three"
}
]
Expand Down
28 changes: 22 additions & 6 deletions test/recorded/api.getProperties-project-not-found/fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"content-encoding": "gzip",
"content-security-policy": "default-src 'none'",
"content-type": "application/json; charset=utf-8",
"date": "Mon, 13 Feb 2023 19:41:22 GMT",
"date": "Sat, 20 May 2023 00:15:13 GMT",
"referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"server": "GitHub.com",
"strict-transport-security": "max-age=31536000; includeSubdomains; preload",
Expand All @@ -24,20 +24,36 @@
"x-content-type-options": "nosniff",
"x-frame-options": "deny",
"x-github-media-type": "github.v3; format=json",
"x-github-request-id": "D668:589A:4B5E728:9BD7F59:63EA9262",
"x-github-request-id": "E53B:4AD2:8F6A462:944B6F1:64681111",
"x-ratelimit-limit": "5000",
"x-ratelimit-remaining": "4985",
"x-ratelimit-reset": "1676319618",
"x-ratelimit-remaining": "4989",
"x-ratelimit-reset": "1684545298",
"x-ratelimit-resource": "graphql",
"x-ratelimit-used": "15",
"x-ratelimit-used": "11",
"x-xss-protection": "0"
},
"data": {
"data": {
"userOrOrganization": {
"projectV2": null
}
}
},
"errors": [
{
"type": "NOT_FOUND",
"path": [
"userOrOrganization",
"projectV2"
],
"locations": [
{
"line": 5,
"column": 9
}
],
"message": "Could not resolve to a ProjectV2 with the number 99999."
}
]
}
}
}
Expand Down
28 changes: 14 additions & 14 deletions test/recorded/api.getProperties/fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"query": "\n query getProjectCoreData($owner: String!, $number: Int!) {\n userOrOrganization: repositoryOwner(login: $owner) {\n ... on ProjectV2Owner {\n projectV2(number: $number) {\n \n id\n title\n url\n databaseId\n fields(first: 50) {\n nodes {\n ... on ProjectV2FieldCommon {\n id\n dataType\n name\n }\n ... on ProjectV2SingleSelectField {\n options {\n id\n name\n }\n }\n ... on ProjectV2IterationField {\n configuration {\n iterations {\n title\n duration\n startDate\n }\n completedIterations {\n title\n duration\n startDate\n }\n duration\n startDay\n }\n }\n }\n }\n\n }\n }\n }\n }\n",
"variables": {
"owner": "github-project-fixtures",
"number": 6
"number": 2
},
"response": {
"status": 200,
Expand All @@ -15,7 +15,7 @@
"content-encoding": "gzip",
"content-security-policy": "default-src 'none'",
"content-type": "application/json; charset=utf-8",
"date": "Mon, 13 Feb 2023 19:20:21 GMT",
"date": "Sat, 20 May 2023 00:15:04 GMT",
"referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"server": "GitHub.com",
"strict-transport-security": "max-age=31536000; includeSubdomains; preload",
Expand All @@ -24,21 +24,21 @@
"x-content-type-options": "nosniff",
"x-frame-options": "deny",
"x-github-media-type": "github.v3; format=json",
"x-github-request-id": "D452:6D7A:5023F18:A551E2C:63EA8D75",
"x-github-request-id": "E52F:433E:579D7F9:5A2B07A:64681108",
"x-ratelimit-limit": "5000",
"x-ratelimit-remaining": "4997",
"x-ratelimit-reset": "1676319618",
"x-ratelimit-remaining": "4995",
"x-ratelimit-reset": "1684545298",
"x-ratelimit-resource": "graphql",
"x-ratelimit-used": "3",
"x-ratelimit-used": "5",
"x-xss-protection": "0"
},
"data": {
"data": {
"userOrOrganization": {
"projectV2": {
"id": "PVT_1",
"title": "@tmelliottjrs Test Fixtures",
"url": "https://github.com/orgs/github-project-fixtures/projects/6",
"title": "@gr2m's Test Fixtures",
"url": "https://github.com/orgs/github-project-fixtures/projects/2",
"databaseId": 1001,
"fields": {
"nodes": [
Expand All @@ -58,15 +58,15 @@
"name": "Status",
"options": [
{
"id": "a57b7c0b",
"id": "f75ad846",
"name": "Todo"
},
{
"id": "e5a5bc6d",
"id": "47fc9ee4",
"name": "In Progress"
},
{
"id": "7eb1a684",
"id": "98236657",
"name": "Done"
}
]
Expand Down Expand Up @@ -117,15 +117,15 @@
"name": "Single select",
"options": [
{
"id": "c35f8785",
"id": "b92ebdaa",
"name": "One"
},
{
"id": "7390103a",
"id": "8a0f266e",
"name": "Two"
},
{
"id": "cbba01c9",
"id": "7ec185b4",
"name": "Three"
}
]
Expand Down
18 changes: 10 additions & 8 deletions test/recorded/api.items.add-draft-with-empty-fields/fixtures.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"query": "\n query getProjectCoreData($owner: String!, $number: Int!) {\n userOrOrganization: repositoryOwner(login: $owner) {\n ... on ProjectV2Owner {\n projectV2(number: $number) {\n \n id\n title\n url\n fields(first: 50) {\n nodes {\n ... on ProjectV2FieldCommon {\n id\n dataType\n name\n }\n ... on ProjectV2SingleSelectField {\n options {\n id\n name\n }\n }\n ... on ProjectV2IterationField {\n configuration {\n iterations {\n title\n duration\n startDate\n }\n completedIterations {\n title\n duration\n startDate\n }\n duration\n startDay\n }\n }\n }\n }\n\n }\n }\n }\n }\n",
"query": "\n query getProjectCoreData($owner: String!, $number: Int!) {\n userOrOrganization: repositoryOwner(login: $owner) {\n ... on ProjectV2Owner {\n projectV2(number: $number) {\n \n id\n title\n url\n databaseId\n fields(first: 50) {\n nodes {\n ... on ProjectV2FieldCommon {\n id\n dataType\n name\n }\n ... on ProjectV2SingleSelectField {\n options {\n id\n name\n }\n }\n ... on ProjectV2IterationField {\n configuration {\n iterations {\n title\n duration\n startDate\n }\n completedIterations {\n title\n duration\n startDate\n }\n duration\n startDay\n }\n }\n }\n }\n\n }\n }\n }\n }\n",
"variables": {
"owner": "github-project-fixtures",
"number": 2
Expand All @@ -15,7 +15,7 @@
"content-encoding": "gzip",
"content-security-policy": "default-src 'none'",
"content-type": "application/json; charset=utf-8",
"date": "Sun, 29 Jan 2023 18:46:28 GMT",
"date": "Sat, 20 May 2023 00:15:34 GMT",
"referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"server": "GitHub.com",
"strict-transport-security": "max-age=31536000; includeSubdomains; preload",
Expand All @@ -24,10 +24,10 @@
"x-content-type-options": "nosniff",
"x-frame-options": "deny",
"x-github-media-type": "github.v3; format=json",
"x-github-request-id": "E137:7B16:2E4984:307942:63D6BF04",
"x-github-request-id": "E556:244C:A572F54:AA8BBAB:64681125",
"x-ratelimit-limit": "5000",
"x-ratelimit-remaining": "4974",
"x-ratelimit-reset": "1675021300",
"x-ratelimit-reset": "1684545298",
"x-ratelimit-resource": "graphql",
"x-ratelimit-used": "26",
"x-xss-protection": "0"
Expand All @@ -39,6 +39,7 @@
"id": "PVT_1",
"title": "@gr2m's Test Fixtures",
"url": "https://github.com/orgs/github-project-fixtures/projects/2",
"databaseId": 1001,
"fields": {
"nodes": [
{
Expand Down Expand Up @@ -165,7 +166,7 @@
}
},
{
"query": "\n mutation addProjectV2DraftIssue($projectId: ID!, $title: String!, $body: String, $assigneeIds: [ID!]) {\n addProjectV2DraftIssue(input: {projectId: $projectId, title: $title, body: $body, assigneeIds: $assigneeIds}) {\n projectItem {\n \n id\n createdAt\n type\n \n content {\n ... on DraftIssue {\n id\n title\n createdAt\n updatedAt\n author: creator {\n login\n }\n assignees(first: 10) {\n nodes {\n login\n }\n }\n }\n ... on Issue {\n \n id\n databaseId\n number\n title\n url\n createdAt\n author {\n login\n }\n assignees(first: 10) {\n nodes {\n login\n }\n }\n labels(first: 10) {\n nodes {\n name\n }\n }\n closed\n milestone {\n number\n title\n state\n }\n repository {\n name\n }\n\n }\n ... on PullRequest {\n \n id\n databaseId\n number\n title\n url\n createdAt\n author {\n login\n }\n assignees(first: 10) {\n nodes {\n login\n }\n }\n labels(first: 10) {\n nodes {\n name\n }\n }\n closed\n milestone {\n number\n title\n state\n }\n repository {\n name\n }\n\n merged\n }\n }\n\n fieldValues(first: 20) {\n nodes {\n __typename\n ... on ProjectV2ItemFieldDateValue {\n date\n field {\n ... on ProjectV2Field {\n id\n }\n }\n }\n ... on ProjectV2ItemFieldIterationValue {\n title\n iterationId\n startDate\n duration\n field {\n ... on ProjectV2IterationField {\n id\n }\n }\n }\n ... on ProjectV2ItemFieldNumberValue {\n number\n field {\n ... on ProjectV2Field {\n id\n }\n }\n }\n ... on ProjectV2ItemFieldSingleSelectValue {\n optionId\n field {\n ... on ProjectV2SingleSelectField {\n id\n }\n }\n }\n ... on ProjectV2ItemFieldTextValue {\n text\n field {\n ... on ProjectV2Field {\n id\n }\n }\n }\n }\n }\n\n }\n }\n }\n",
"query": "\n mutation addProjectV2DraftIssue($projectId: ID!, $title: String!, $body: String, $assigneeIds: [ID!]) {\n addProjectV2DraftIssue(input: {projectId: $projectId, title: $title, body: $body, assigneeIds: $assigneeIds}) {\n projectItem {\n \n id\n createdAt\n type\n isArchived\n \n content {\n ... on DraftIssue {\n id\n title\n createdAt\n updatedAt\n author: creator {\n login\n }\n assignees(first: 10) {\n nodes {\n login\n }\n }\n }\n ... on Issue {\n \n id\n databaseId\n number\n title\n url\n createdAt\n author {\n login\n }\n assignees(first: 10) {\n nodes {\n login\n }\n }\n labels(first: 10) {\n nodes {\n name\n }\n }\n closed\n closedAt\n milestone {\n number\n title\n state\n }\n repository {\n name\n }\n\n }\n ... on PullRequest {\n \n id\n databaseId\n number\n title\n url\n createdAt\n author {\n login\n }\n assignees(first: 10) {\n nodes {\n login\n }\n }\n labels(first: 10) {\n nodes {\n name\n }\n }\n closed\n closedAt\n milestone {\n number\n title\n state\n }\n repository {\n name\n }\n\n merged\n }\n }\n\n fieldValues(first: 20) {\n nodes {\n __typename\n ... on ProjectV2ItemFieldDateValue {\n date\n field {\n ... on ProjectV2Field {\n id\n }\n }\n }\n ... on ProjectV2ItemFieldIterationValue {\n title\n iterationId\n startDate\n duration\n field {\n ... on ProjectV2IterationField {\n id\n }\n }\n }\n ... on ProjectV2ItemFieldNumberValue {\n number\n field {\n ... on ProjectV2Field {\n id\n }\n }\n }\n ... on ProjectV2ItemFieldSingleSelectValue {\n optionId\n field {\n ... on ProjectV2SingleSelectField {\n id\n }\n }\n }\n ... on ProjectV2ItemFieldTextValue {\n text\n field {\n ... on ProjectV2Field {\n id\n }\n }\n }\n }\n }\n\n }\n }\n }\n",
"variables": {
"projectId": "PVT_1",
"title": "Draft Title"
Expand All @@ -180,7 +181,7 @@
"content-encoding": "gzip",
"content-security-policy": "default-src 'none'",
"content-type": "application/json; charset=utf-8",
"date": "Sun, 29 Jan 2023 18:46:29 GMT",
"date": "Sat, 20 May 2023 00:15:35 GMT",
"referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"server": "GitHub.com",
"strict-transport-security": "max-age=31536000; includeSubdomains; preload",
Expand All @@ -189,10 +190,10 @@
"x-content-type-options": "nosniff",
"x-frame-options": "deny",
"x-github-media-type": "github.v3; format=json",
"x-github-request-id": "E13A:34F7:3699A9:38CAF5:63D6BF05",
"x-github-request-id": "E557:7581:960B068:9AB18CA:64681126",
"x-ratelimit-limit": "5000",
"x-ratelimit-remaining": "4973",
"x-ratelimit-reset": "1675021300",
"x-ratelimit-reset": "1684545298",
"x-ratelimit-resource": "graphql",
"x-ratelimit-used": "27",
"x-xss-protection": "0"
Expand All @@ -204,6 +205,7 @@
"id": "PVTI_1",
"createdAt": "2022-02-02T12:00:00Z",
"type": "DRAFT_ISSUE",
"isArchived": false,
"content": {
"id": "DI_1",
"title": "Draft Title",
Expand Down
Loading