From b0e2beaad0b04b280688d0b39f5d9ea74426f5e9 Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 11 Nov 2024 20:21:01 -0800 Subject: [PATCH] feat: add xfer to project workflow --- .github/workflows/transfer-to-project.yml | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/transfer-to-project.yml diff --git a/.github/workflows/transfer-to-project.yml b/.github/workflows/transfer-to-project.yml new file mode 100644 index 0000000000..f3a347fa92 --- /dev/null +++ b/.github/workflows/transfer-to-project.yml @@ -0,0 +1,43 @@ +name: Transfer Issues & PRs to DevTools Project + +on: + issues: + types: [opened] + +jobs: + transfer: + runs-on: ubuntu-latest + steps: + - name: Transfer Issue + uses: actions/github-script@v5 + 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 });