From f5fc6be192aafd7f4e1333157fbdb9c3c983ef5e Mon Sep 17 00:00:00 2001 From: "louismaxime.piton" Date: Fri, 23 Jun 2023 12:04:35 +0200 Subject: [PATCH 1/4] New workflow --- .../update-pr-review-in-progress.yml | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/update-pr-review-in-progress.yml diff --git a/.github/workflows/update-pr-review-in-progress.yml b/.github/workflows/update-pr-review-in-progress.yml new file mode 100644 index 0000000000..f2d0a8d7d0 --- /dev/null +++ b/.github/workflows/update-pr-review-in-progress.yml @@ -0,0 +1,85 @@ +name: Dev review in progress move PR in the right column +on: + pull_request_review: + types: + - submitted + +jobs: + project-move-card: + if: github.event.review.state != 'approved' && github.event.review.user != 'julien-deramond' && github.event.review.user != 'Aniort' + runs-on: ubuntu-latest + steps: + - name: Get Project Data + env: + GITHUB_TOKEN: ${{ secrets.BOOSTED_MOD_PERSONAL_TOKEN_CLASSIC }} + ORGANIZATION: ${{ github.repository_owner }} + PR_ID: ${{ github.event.pull_request.node_id }} + PROJECT_NUMBER: 12 + PROJECT_TARGET_COL: "Dev Review In Progress" + run: | + gh api graphql -f query=' + query($org: String!, $number: Int!) { + organization(login: $org){ + projectV2(number: $number) { + id + fields(first:20) { + nodes { + ... on ProjectV2Field { + id + name + } + ... on ProjectV2SingleSelectField { + id + name + options { + id + name + } + } + } + } + items(first:20) { + nodes { + id + content { + ... on PullRequest { + id + } + } + } + } + } + } + }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json + + # echo `cat project_data.json` + + echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV + echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV + echo 'TARGET_COL_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .options[] | select(.name=="${{ env.PROJECT_TARGET_COL }}") |.id' project_data.json) >> $GITHUB_ENV + echo 'ITEM_ID='$(jq '.data.organization.projectV2.items.nodes[] | select(.content.id=="${{ env.PR_ID }}") |.id' project_data.json) >> $GITHUB_ENV + + - name: Move to Dev Review in Progress Column + env: + GITHUB_TOKEN: ${{ secrets.BOOSTED_MOD_PERSONAL_TOKEN_CLASSIC }} + run: | + 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 + } + }) { + projectV2Item { + id + } + } + }' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.TARGET_COL_ID }} --silent From a878a0e3b49864051f18520ff421d74c934af141 Mon Sep 17 00:00:00 2001 From: "louismaxime.piton" Date: Fri, 23 Jun 2023 14:10:26 +0200 Subject: [PATCH 2/4] Fix typo --- .github/workflows/update-pr-review-in-progress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-pr-review-in-progress.yml b/.github/workflows/update-pr-review-in-progress.yml index f2d0a8d7d0..4e42aa6e18 100644 --- a/.github/workflows/update-pr-review-in-progress.yml +++ b/.github/workflows/update-pr-review-in-progress.yml @@ -1,11 +1,11 @@ -name: Dev review in progress move PR in the right column +name: Move card to Dev Review in Progess column on: pull_request_review: types: - submitted jobs: - project-move-card: + move_card_to_dev_review_in_progress: if: github.event.review.state != 'approved' && github.event.review.user != 'julien-deramond' && github.event.review.user != 'Aniort' runs-on: ubuntu-latest steps: From f04eef78a392a0ec4c8c3ef60d646e50a1a6913c Mon Sep 17 00:00:00 2001 From: "louismaxime.piton" Date: Mon, 3 Jul 2023 11:52:01 +0200 Subject: [PATCH 3/4] . --- .github/workflows/update-pr-review-in-progress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-pr-review-in-progress.yml b/.github/workflows/update-pr-review-in-progress.yml index 4e42aa6e18..4433953119 100644 --- a/.github/workflows/update-pr-review-in-progress.yml +++ b/.github/workflows/update-pr-review-in-progress.yml @@ -6,7 +6,7 @@ on: jobs: move_card_to_dev_review_in_progress: - if: github.event.review.state != 'approved' && github.event.review.user != 'julien-deramond' && github.event.review.user != 'Aniort' + if: github.event.pull_request.draft == false && github.event.review.state != 'approved' && github.event.review.user != 'julien-deramond' && github.event.review.user != 'Aniort' runs-on: ubuntu-latest steps: - name: Get Project Data From 994586a63f7fa2a408043aaa8a1add7b7637bf95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20D=C3=A9ramond?= Date: Mon, 28 Aug 2023 08:49:00 +0200 Subject: [PATCH 4/4] Use Actions variables --- .github/workflows/update-pr-review-in-progress.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-pr-review-in-progress.yml b/.github/workflows/update-pr-review-in-progress.yml index 4433953119..75cac7082d 100644 --- a/.github/workflows/update-pr-review-in-progress.yml +++ b/.github/workflows/update-pr-review-in-progress.yml @@ -6,7 +6,7 @@ on: jobs: move_card_to_dev_review_in_progress: - if: github.event.pull_request.draft == false && github.event.review.state != 'approved' && github.event.review.user != 'julien-deramond' && github.event.review.user != 'Aniort' + if: github.event.pull_request.draft == false && github.event.review.state != 'approved' && github.event.review.user != ${{ vars.LEAD_DEV_GH_USERNAME }} && github.event.review.user != ${{ vars.A11Y_REVIEWER_GH_USERNAME }} runs-on: ubuntu-latest steps: - name: Get Project Data @@ -14,8 +14,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.BOOSTED_MOD_PERSONAL_TOKEN_CLASSIC }} ORGANIZATION: ${{ github.repository_owner }} PR_ID: ${{ github.event.pull_request.node_id }} - PROJECT_NUMBER: 12 - PROJECT_TARGET_COL: "Dev Review In Progress" + PROJECT_NUMBER: ${{ vars.PR_BOARD_PROJECT_NUMBER }} + PROJECT_TARGET_COL: ${{ vars.PR_BOARD_DEV_REVIEW_IN_PROGRESS_COL_NAME }} run: | gh api graphql -f query=' query($org: String!, $number: Int!) {