From 9cb7e89a688304fdd439411e2854235c358f4ab7 Mon Sep 17 00:00:00 2001 From: Josh Ford Date: Thu, 21 Nov 2024 17:43:16 -0800 Subject: [PATCH] fix: update add to devtools project workflow --- .github/workflows/transfer-to-project.yml | 49 +++++++---------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/.github/workflows/transfer-to-project.yml b/.github/workflows/transfer-to-project.yml index f3a347fa9..35bd989f8 100644 --- a/.github/workflows/transfer-to-project.yml +++ b/.github/workflows/transfer-to-project.yml @@ -1,43 +1,22 @@ -name: Transfer Issues & PRs to DevTools Project +name: 'Add to DevTools Project' on: issues: - types: [opened] + types: + - opened + - reopened + pull_request: + types: + - opened + - reopened jobs: - transfer: + add-to-project: + name: Add issue/PR to project runs-on: ubuntu-latest steps: - - name: Transfer Issue - uses: actions/github-script@v5 + - uses: actions/add-to-project@v1.0.0 with: - github-token: ${{secrets.GH_TOKEN}} - script: | - const issueTitle = context.payload.issue.title; - const issueBody = context.payload.issue.body; - const issueNumber = context.payload.issue.number; - const organizationName = 'near'; - const projectName = 'DevTools'; - // Fetch project ID and other necessary IDs - const query = ` - query { - organization(login: "${organizationName}") { - projectV2(number: 156) { - id - } - } - } - `; - const projectIdResponse = await github.graphql(query); - const projectId = projectIdResponse.organization.projectV2.id; - // Add issue to the project - const mutation = ` - mutation($projectId: ID!, $contentId: ID!) { - addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) { - item { - id - } - } - } - `; - await github.graphql(mutation, { projectId: projectId, contentId: context.payload.issue.node_id }); + # add to DevTools Project #156 + project-url: https://github.com/orgs/near/projects/156 + github-token: ${{ secrets.GH_TOKEN }}