Skip to content

Commit f5f01b8

Browse files
committed
ci: fix some syntax issues with discord + github integrations
1 parent bc656a2 commit f5f01b8

File tree

1 file changed

+23
-29
lines changed

1 file changed

+23
-29
lines changed

.github/workflows/team-triage.yml

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ jobs:
5656
const threadName = `#${itemNumber}: ${title}`.substring(0, 100);
5757
5858
const payload = {
59-
thread_name: threadName,
60-
content: `🧵 **Team Discussion Thread**\n\n**${itemType}:** [#${itemNumber} ${title}](${itemUrl})\n**Author:** [\`${author}\`](https://github.com/${author})\n**Requested by:** [\`${requester}\`](https://github.com/${requester})\n\nThis thread has been created for team discussion about the above ${itemType.toLowerCase()}. Please share your thoughts and feedback here.`
59+
content: `🧵 **Team Discussion Thread**\n\n**${itemType}:** [#${itemNumber} ${title}](${itemUrl})\n**Author:** [\`${author}\`](https://github.com/${author})\n**Requested by:** [\`${requester}\`](https://github.com/${requester})\n\nThis thread has been created to discuss implementation details, concerns, and decisions.`
6160
};
6261
6362
try {
64-
const response = await fetch(`${webhookUrl}?thread_name=${encodeURIComponent(threadName)}`, {
63+
const response = await fetch(webhookUrl, {
6564
method: 'POST',
6665
headers: {
6766
'Content-Type': 'application/json',
@@ -70,12 +69,12 @@ jobs:
7069
});
7170
7271
if (response.ok) {
73-
console.log('Discord thread created successfully');
72+
console.log('Discord message posted successfully');
7473
} else {
75-
console.log('Failed to create Discord thread:', response.status, response.statusText);
74+
console.log('Failed to create Discord message:', response.status, response.statusText);
7675
}
7776
} catch (error) {
78-
console.log('Error creating Discord thread:', error.message);
77+
console.log('Error creating Discord message:', error.message);
7978
}
8079
8180
- name: Add to Team Board Project
@@ -99,13 +98,9 @@ jobs:
9998
const issueNodeId = issue.node_id;
10099
101100
try {
102-
// Add issue to project
103101
const addToProjectMutation = `
104-
mutation($projectId: ID!, $contentId: ID!) {
105-
addProjectV2ItemByContentId(input: {
106-
projectId: $projectId
107-
contentId: $contentId
108-
}) {
102+
mutation($input: AddProjectV2ItemByIdInput!) {
103+
addProjectV2ItemById(input: $input) {
109104
item {
110105
id
111106
}
@@ -114,22 +109,19 @@ jobs:
114109
`;
115110
116111
const addResult = await github.graphql(addToProjectMutation, {
117-
projectId: projectId,
118-
contentId: issueNodeId
112+
input: {
113+
projectId: projectId,
114+
contentId: issueNodeId
115+
}
119116
});
120117
121-
const itemId = addResult.addProjectV2ItemByContentId.item.id;
122-
console.log('Added issue to project with item ID:', itemId);
118+
const itemId = addResult.addProjectV2ItemById.item.id;
119+
console.log('Added item to project with item ID:', itemId);
123120
124-
// Set status to "Discussing"
121+
// Set status to "Discussing"
125122
const updateStatusMutation = `
126-
mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $value: ProjectV2FieldValue!) {
127-
updateProjectV2ItemFieldValue(input: {
128-
projectId: $projectId
129-
itemId: $itemId
130-
fieldId: $fieldId
131-
value: $value
132-
}) {
123+
mutation($input: UpdateProjectV2ItemFieldValueInput!) {
124+
updateProjectV2ItemFieldValue(input: $input) {
133125
projectV2Item {
134126
id
135127
}
@@ -138,11 +130,13 @@ jobs:
138130
`;
139131
140132
await github.graphql(updateStatusMutation, {
141-
projectId: projectId,
142-
itemId: itemId,
143-
fieldId: discussingStatusId,
144-
value: {
145-
singleSelectOptionId: process.env.DISCUSSING_OPTION_ID
133+
input: {
134+
projectId: projectId,
135+
itemId: itemId,
136+
fieldId: discussingStatusId,
137+
value: {
138+
singleSelectOptionId: process.env.DISCUSSING_OPTION_ID
139+
}
146140
}
147141
});
148142

0 commit comments

Comments
 (0)