diff --git a/.github/workflows/issue_set_merged.yml b/.github/workflows/issue_set_merged.yml new file mode 100644 index 00000000..a9eafee3 --- /dev/null +++ b/.github/workflows/issue_set_merged.yml @@ -0,0 +1,19 @@ +name: Add 'merged' label to closed PR + +on: + pull_request: + types: + - closed + +jobs: + set_merged: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Add 'merged' label to closed PR + run: gh issue edit "$PR_NUMBER" --add-label "merged" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} diff --git a/.github/workflows/project_automation.yml b/.github/workflows/project_set_pending.yml similarity index 79% rename from .github/workflows/project_automation.yml rename to .github/workflows/project_set_pending.yml index 06fc9499..217fbf60 100644 --- a/.github/workflows/project_automation.yml +++ b/.github/workflows/project_set_pending.yml @@ -1,4 +1,4 @@ -name: Add PR to project as pending status +name: Add New PR to project as pending status on: pull_request: @@ -6,7 +6,7 @@ on: - opened jobs: - track_pr: + set_pending: runs-on: ubuntu-latest steps: # Github App을 사용하여 토큰 생성 @@ -14,8 +14,8 @@ jobs: id: generate_token uses: actions/create-github-app-token@v1 with: - app_id: ${{ secrets.BOT_APP_ID }} - private_key: ${{ secrets.BOT_APP_PEM }} + app-id: ${{ secrets.BOT_APP_ID }} + private-key: ${{ secrets.BOT_APP_PEM }} # Github CLI를 사용하여 프로젝트 ID 및 필드 정보를 조회 후 project_data.json 파일에 저장 - name: Get project data @@ -79,23 +79,20 @@ jobs: env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} run: | + PENDING_OPTION_ID="${{ env.PENDING_OPTION_ID }}" + gh api graphql -f query=' - mutation ( - $project: ID! - $item: ID! - $status_field: ID! - $status_value: String! - ) { - set_status: updateProjectV2ItemFieldValue(input: { - projectId: $project - itemId: $item - fieldId: $status_field - value: { - singleSelectOptionId: $status_value - } - }) { + mutation ($project: ID!, $item: ID!, $status_field: ID!, $status_value: String!) { + updateProjectV2ItemFieldValue( + input: { + projectId: $project, + itemId: $item, + fieldId: $status_field, + value: {singleSelectOptionId: $status_value} + } + ) { projectV2Item { id - } } - }' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=$PENDING_OPTION_ID --silent + } + }' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=$PENDING_OPTION_ID --silent