1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Github Api GraphQLでissiue作成&project紐付けなどをやってみました

Last updated at Posted at 2024-01-10

issue作成

mutation createIssue($title: String!, $body: String, $labelIds: [ID!]) {
      createIssue(input:{title: $title, body: $body, repositoryId: "Your Repository Id", labelIds: $labelIds}) {
        issue {
          id
          number
        }
      }
    }

issueをproject(beta)に登録

mutation addProjectV2ItemById($issueId: ID!, $projectId: ID!) {
      addProjectV2ItemById(input: {contentId: $issueId, projectId: $projectId}) {
        item {
          id
        }
      }
    }

project(beta)に紐ついたissueのprojectカスタム項目を更新(複数)

mutation updateProjectV2ItemFieldValue($issueId: ID!, $column1: String!, $column2: Float!, $column1FieldId: ID!, $column2FieldId: ID!, $projectId: ID!) {
      updateColumn1: updateProjectV2ItemFieldValue(input:{itemId: $issueId, fieldId: $column1FieldId, projectId: $projectId, value: {iterationId: $column1Id}}) {
        clientMutationId
      },
      updateColumn2: updateProjectV2ItemFieldValue(input:{itemId: $issueId, fieldId: $column2FieldId, projectId: $projectId, value: {number: $column2}}){
        clientMutationId
      }
    }

Iteration項目のvalue idを見つかる

query($org: String!, $projectNum: Int!, $fieldName: String!) {
      organization(login: $org) {
        projectV2(number: $projectNum) {
          field(name: $fieldName) {
            ... on ProjectV2IterationField {
             id
              configuration {
                iterations {
                  id
                  title
                }
              }
            }
          }
        }
      }
    }

最後に

projectV2のField探す、repository id探すなどは以前の記事にすでに紹介ずみ

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?