From acd8d645c48cc7fbc2b93ba07b9baf8526881d5d Mon Sep 17 00:00:00 2001 From: Jaehyun Ahn <91878695+uwoobeat@users.noreply.github.com> Date: Wed, 6 Dec 2023 15:17:00 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20PR=20close=20=EC=8B=9C=20merged=20?= =?UTF-8?q?=EB=9D=BC=EB=B2=A8=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EA=B8=B0?= =?UTF-8?q?=EC=A1=B4=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=20=ED=94=BD?= =?UTF-8?q?=EC=8A=A4=20(#43)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 워크플로 이름 수정 * refactor: 파일명 변경 * chore: PR이 closed 될 때 merged 라벨 추가하는 워크플로 작성 * chore: 테스트용 트리거 추가 * chore: 권한 설정 변경 * chore: 테스트 트리거 재설정 * chore: 테스트 트리거 롤백 * chore: 프로젝트 워크플로 테스트 트리거 활성화 * chore: 코드 정적 분석 SonarCloud 설정 (#38) * chore: 코드 정적 분석 SonarCloud 설정 (#38) * chore: pending 워크플로우의 쿼리 수정 * fix: pending 상태 id 값 직접 삽입 * fix: 쿼리 전 인자값을 미리 선언하도록 지정 * chore: 테스트 트리거 롤백 * chore: 잡 이름 변경 * chore: 워크플로 이름 변경 --------- Co-authored-by: yb__char <68099546+uiurihappy@users.noreply.github.com> Co-authored-by: ybchar --- .github/workflows/issue_set_merged.yml | 19 ++++++++++ ...automation.yml => project_set_pending.yml} | 37 +++++++++---------- 2 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/issue_set_merged.yml rename .github/workflows/{project_automation.yml => project_set_pending.yml} (79%) diff --git a/.github/workflows/issue_set_merged.yml b/.github/workflows/issue_set_merged.yml new file mode 100644 index 000000000..a9eafee3b --- /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 06fc94998..217fbf606 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