diff --git a/.github/workflows/new_discussion_to_project.yml b/.github/workflows/new_discussion_to_project.yml index 0541721..1a52483 100644 --- a/.github/workflows/new_discussion_to_project.yml +++ b/.github/workflows/new_discussion_to_project.yml @@ -15,7 +15,7 @@ jobs: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.APP_PRIVATE_KEY }} - - name: Get discussion details and add to project + - name: Add discussion to project uses: actions/github-script@v7 with: github-token: ${{ steps.generate_token.outputs.token }} @@ -26,20 +26,11 @@ jobs: const orgLogin = eventPayload.organization.login; const repoName = eventPayload.repository.name; - const discussionNumber = eventPayload.discussion.number; + const discussion = eventPayload.discussion; - console.log(`Organization: ${orgLogin}, Repository: ${repoName}, Discussion Number: ${discussionNumber}`); + console.log(`Organization: ${orgLogin}, Repository: ${repoName}, Discussion Number: ${discussion.number}`); try { - // Fetch discussion details - const { data: discussion } = await github.rest.discussions.get({ - owner: orgLogin, - repo: repoName, - discussion_number: discussionNumber - }); - - console.log('Discussion details:', JSON.stringify(discussion, null, 2)); - // Add discussion to project const response = await github.rest.projects.createCard({ column_id: 'YOUR_PROJECT_COLUMN_ID',