Skip to content

Commit

Permalink
chore: more debug. maybe working now :)
Browse files Browse the repository at this point in the history
  • Loading branch information
reinamora137 committed Sep 10, 2024
1 parent 2084306 commit 9f19dfb
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/new_discussion_to_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,29 @@ jobs:
console.log('Event payload:', JSON.stringify(eventPayload, null, 2));
const orgLogin = eventPayload.organization.login;
const repoName = eventPayload.repository.name;
const discussion = eventPayload.discussion;
console.log(`Organization: ${orgLogin}, Repository: ${repoName}, Discussion Number: ${discussion.number}`);
console.log(`Organization: ${orgLogin}, Discussion Number: ${discussion.number}`);
const query = `
mutation($projectId:ID!, $contentId:ID!) {
addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) {
item {
id
}
}
}
`;
try {
// Add discussion to project
const response = await github.rest.projects.createCard({
column_id: 'YOUR_PROJECT_COLUMN_ID',
content_id: discussion.id,
content_type: 'Discussion'
const result = await github.graphql(query, {
projectId: "3",
contentId: discussion.node_id
});
console.log('Added to project:', JSON.stringify(response.data, null, 2));
console.log('Added to project:', JSON.stringify(result, null, 2));
return discussion.id;
return result.addProjectV2ItemById.item.id;
} catch (error) {
console.error('Error:', error);
throw error;
Expand Down

0 comments on commit 9f19dfb

Please sign in to comment.