Skip to content

Commit

Permalink
chore: some more debug on scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
reinamora137 committed Sep 10, 2024
1 parent 4a395e8 commit 5b60a8c
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions .github/workflows/new_discussion_to_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,40 @@ jobs:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Get discussion details
id: get-discussion
- name: Debug Info
run: |
echo "Event: ${{ github.event_name }}"
echo "Action: ${{ github.event.action }}"
echo "Discussion ID: ${{ github.event.discussion.node_id }}"
echo "Discussion Number: ${{ github.event.discussion.number }}"
echo "Organization: ${{ github.repository_owner }}"
- name: Add to project
uses: actions/github-script@v6
with:
github-token: ${{ steps.generate_token.outputs.token }}
script: |
console.log('Event payload:', JSON.stringify(context.payload, null, 2));
const projectId = 'PVT_kwDOCAGLAM4Anzfw';
const discussionId = context.payload.discussion.node_id;
console.log('Discussion ID:', discussionId);
return discussionId;
- name: Add to project
uses: actions/[email protected]
with:
project-url: https://github.com/orgs/stampchain-io/projects/3
github-token: ${{ steps.generate_token.outputs.token }}
content-id: ${{ steps.get-discussion.outputs.result }}
console.log(`Adding discussion ${discussionId} to project ${projectId}`);
try {
const response = await github.graphql(`
mutation($projectId: ID!, $contentId: ID!) {
addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) {
item {
id
}
}
}
`, {
projectId: projectId,
contentId: discussionId
});
console.log('Added to project:', JSON.stringify(response, null, 2));
} catch (error) {
console.error('Error adding to project:', error);
core.setFailed(error.message);
}

0 comments on commit 5b60a8c

Please sign in to comment.