Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit ffff8cf

Browse files
committed
fix issues running action
1 parent 38c8137 commit ffff8cf

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed

dist/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,11 @@ crossReferences: timelineItems(first: 100, itemTypes: [CROSS_REFERENCED_EVENT])
396396
source {
397397
... on Issue {
398398
id
399-
bodyText
399+
body
400400
}
401401
... on PullRequest {
402402
id
403-
bodyText
403+
body
404404
}
405405
}
406406
}
@@ -423,7 +423,7 @@ query($id: ID!) {
423423

424424
const UPDATE_ISSUE_BODY = `
425425
mutation updateIssue($id: ID!, $body: String) {
426-
addProjectCard(input: { id: $id, body: $body }) {
426+
updateIssue(input: { id: $id, body: $body }) {
427427
issue {
428428
id
429429
}
@@ -638,15 +638,17 @@ async function run() {
638638
// find all matching `- [ ] ...<url> or #<number>...` list items in each of
639639
// the cross referenced items and replace the [ ] with [x]
640640
const { node } = await api(queries.GET_CROSSREFERENCED_ITEMS, { id: resource.node_id });
641+
core.info(`found ${node.crossReferences.nodes.length} references`);
641642
node.crossReferences.nodes.forEach(async ({ source: reference }) => {
642643
if (!reference.id) {
643644
// if the cross reference is to a non issue or PR, skip it
644645
return;
645646
}
646647

647648
// if the body changes from checking boxes, push the changes back to GitHub
648-
const updatedBody = reference.bodyText.replace(regex, '$1- [x]$2');
649-
if (updatedBody !== reference.bodyText) {
649+
const updatedBody = reference.body.replace(regex, '$1- [x]$2');
650+
if (updatedBody !== reference.body) {
651+
core.info(`updating ${reference.id}`);
650652
await api(queries.UPDATE_ISSUE_BODY, { id: reference.id, body: updatedBody });
651653
}
652654
});

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sync-task-issues",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "Marks issues and PRs referenced from checkbox lists as completed",
55
"main": "dist/index.js",
66
"scripts": {

src/graphql.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ crossReferences: timelineItems(first: 100, itemTypes: [CROSS_REFERENCED_EVENT])
77
source {
88
... on Issue {
99
id
10-
bodyText
10+
body
1111
}
1212
... on PullRequest {
1313
id
14-
bodyText
14+
body
1515
}
1616
}
1717
}
@@ -34,7 +34,7 @@ query($id: ID!) {
3434

3535
const UPDATE_ISSUE_BODY = `
3636
mutation updateIssue($id: ID!, $body: String) {
37-
addProjectCard(input: { id: $id, body: $body }) {
37+
updateIssue(input: { id: $id, body: $body }) {
3838
issue {
3939
id
4040
}

src/sync-task-issues.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ async function run() {
3333
// find all matching `- [ ] ...<url> or #<number>...` list items in each of
3434
// the cross referenced items and replace the [ ] with [x]
3535
const { node } = await api(queries.GET_CROSSREFERENCED_ITEMS, { id: resource.node_id });
36+
core.info(`found ${node.crossReferences.nodes.length} references`);
3637
node.crossReferences.nodes.forEach(async ({ source: reference }) => {
3738
if (!reference.id) {
3839
// if the cross reference is to a non issue or PR, skip it
3940
return;
4041
}
4142

4243
// if the body changes from checking boxes, push the changes back to GitHub
43-
const updatedBody = reference.bodyText.replace(regex, '$1- [x]$2');
44-
if (updatedBody !== reference.bodyText) {
44+
const updatedBody = reference.body.replace(regex, '$1- [x]$2');
45+
if (updatedBody !== reference.body) {
46+
core.info(`updating ${reference.id}`);
4547
await api(queries.UPDATE_ISSUE_BODY, { id: reference.id, body: updatedBody });
4648
}
4749
});

test/sync-task-issues.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ describe('sync-task-issues', () => {
104104
{
105105
source: {
106106
id: 'source-1',
107-
bodyText: originalBody
107+
body: originalBody
108108
}
109109
},
110110
{
111111
source: {
112112
id: 'source-2',
113-
bodyText: originalBody
113+
body: originalBody
114114
}
115115
}
116116
];
@@ -195,13 +195,13 @@ describe('sync-task-issues', () => {
195195
{
196196
source: {
197197
id: 'source-1',
198-
bodyText: originalBody
198+
body: originalBody
199199
}
200200
},
201201
{
202202
source: {
203203
id: 'source-2',
204-
bodyText: originalBody
204+
body: originalBody
205205
}
206206
}
207207
];

0 commit comments

Comments
 (0)