[TEST] TestContainer 도입 #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Move Issue to In Progress on Assign | |
| on: | |
| issues: | |
| types: [assigned] | |
| jobs: | |
| move-to-in-progress: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Move issue to In Progress | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.PROJECT_TOKEN }} | |
| script: | | |
| const issueNodeId = context.payload.issue.node_id; | |
| const org = context.repo.owner; | |
| const projectNumber = 2; | |
| // 이슈가 속한 프로젝트 아이템 ID 조회 | |
| const issueResult = await github.graphql(` | |
| query($nodeId: ID!) { | |
| node(id: $nodeId) { | |
| ... on Issue { | |
| projectItems(first: 10) { | |
| nodes { | |
| id | |
| project { | |
| number | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| `, { nodeId: issueNodeId }); | |
| const projectItems = issueResult.node.projectItems.nodes; | |
| const item = projectItems.find(i => i.project.number === projectNumber); | |
| if (!item) { | |
| core.warning(`Issue is not in project #${projectNumber}. Skipping.`); | |
| return; | |
| } | |
| const itemId = item.id; | |
| // 프로젝트 메타데이터 조회 | |
| const projectResult = await github.graphql(` | |
| query($org: String!, $number: Int!) { | |
| organization(login: $org) { | |
| projectV2(number: $number) { | |
| id | |
| fields(first: 20) { | |
| nodes { | |
| ... on ProjectV2SingleSelectField { | |
| id | |
| name | |
| options { | |
| id | |
| name | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| `, { org, number: projectNumber }); | |
| const project = projectResult.organization.projectV2; | |
| const projectId = project.id; | |
| const statusField = project.fields.nodes.find(f => f.name === 'Status'); | |
| if (!statusField) { | |
| core.setFailed('Status field not found in project.'); | |
| return; | |
| } | |
| const inProgressOption = statusField.options.find(o => o.name === 'In Progress'); | |
| if (!inProgressOption) { | |
| const available = statusField.options.map(o => o.name).join(', '); | |
| core.setFailed(`"In Progress" option not found. Available options: ${available}`); | |
| return; | |
| } | |
| // 이슈 상태를 "In Progress"로 변경 | |
| await github.graphql(` | |
| mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) { | |
| updateProjectV2ItemFieldValue(input: { | |
| projectId: $projectId | |
| itemId: $itemId | |
| fieldId: $fieldId | |
| value: { singleSelectOptionId: $optionId } | |
| }) { | |
| projectV2Item { | |
| id | |
| } | |
| } | |
| } | |
| `, { | |
| projectId, | |
| itemId, | |
| fieldId: statusField.id, | |
| optionId: inProgressOption.id | |
| }); | |
| core.info(`Moved issue #${context.payload.issue.number} to "In Progress".`); |