From 8e898afd915d6a0f674f4bcffc36d9ff7c8701a8 Mon Sep 17 00:00:00 2001 From: Justin Retzolk <44710313+justinretzolk@users.noreply.github.com> Date: Mon, 24 Jul 2023 12:30:44 -0500 Subject: [PATCH 1/6] Update Project Automation Workflows --- .ci/scripts/archive-on-milestone-closed.sh | 78 ++++++++++++++++++++ .github/workflows/issues.yml | 28 +++++++ .github/workflows/milestone.yml | 15 ++++ .github/workflows/new-project-automation.yml | 42 ----------- .github/workflows/pull_request_target.yml | 43 +++++++++++ 5 files changed, 164 insertions(+), 42 deletions(-) create mode 100755 .ci/scripts/archive-on-milestone-closed.sh delete mode 100644 .github/workflows/new-project-automation.yml diff --git a/.ci/scripts/archive-on-milestone-closed.sh b/.ci/scripts/archive-on-milestone-closed.sh new file mode 100755 index 000000000000..c7813e41393d --- /dev/null +++ b/.ci/scripts/archive-on-milestone-closed.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +PROJECT_NUMBER=196 +PROJECT_ID="PVT_kwDOAAuecM4AF-7h" + +main () { + ISSUES=$(gh api graphql --paginate -F milestone="$MILESTONE" -f query=' + query($milestone: Int!, $endCursor: String) { + organization(login: "hashicorp") { + repository(name: "terraform-provider-aws") { + milestone(number: $milestone) { + issues(first: 10, after: $endCursor) { + edges { + node { + id + projectItems(includeArchived: false, first: 10) { + nodes { + id + project { + id + } + } + } + } + } + pageInfo { + endCursor + hasNextPage + } + } + } + } + } + }' --jq '.data.organization.repository.milestone.issues.edges[].node.projectItems.nodes[]' | jq --slurp '. | tojson') + + PULLS=$(gh api graphql --paginate -F milestone="$MILESTONE" -f query=' + query($milestone: Int!, $endCursor: String) { + organization(login: "hashicorp") { + repository(name: "terraform-provider-aws") { + milestone(number: $milestone) { + pullRequests(first: 10, after: $endCursor) { + edges { + node { + id + projectItems(includeArchived: false, first: 10) { + nodes { + id + project { + id + } + } + } + } + } + pageInfo { + endCursor + hasNextPage + } + } + } + } + } + }' --jq '.data.organization.repository.milestone.pullRequests.edges[].node.projectItems.nodes[]' | jq --slurp '. | tojson') + + PROJECT_ITEMS=$(jq \ + --null-input \ + --arg project "$PROJECT_ID" \ + --argjson issues "$ISSUES" \ + --argjson pulls "$PULLS" \ + '$issues, $pulls | fromjson | .[] | select(.project.id == $project).id') + + for item in $PROJECT_ITEMS; do + echo "Archiving $item" + gh project item-archive "$PROJECT_NUMBER" --owner "hashicorp" --id "$item" + done +} + +main diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 13d94e6e3cf5..1dd199bc63c4 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -57,6 +57,34 @@ jobs: enable-versioned-regex: 0 include-title: 1 + add_to_project: + name: 'Add to Project' + runs-on: ubuntu-latest + needs: community_check + env: + GH_TOKEN: ${{ secrets.PROJECT_SCOPED_TOKEN }} + # Some gh project calls take the project's ID, some take the project's number + PROJECT_ID: "PVT_kwDOAAuecM4AF-7h" + PROJECT_NUMBER: "196" + STATUS_FIELD_ID: "PVTSSF_lADOAAuecM4AF-7hzgDcsQA" + ITEM_URL: ${{ github.event.issue.html_url }} + steps: + - name: 'Maintainer Issues' + if: github.event.action == 'opened' && needs.community_check.outputs.maintainer == 'true' + run: | + gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + + - name: 'Assigned to Maintainer' + if: github.event.action == 'assigned' && needs.community_check.outputs.maintainer == 'true' + run: | + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_in_progress }} + + - name: 'Labeled Prioritized or Regression' + if: contains(fromJSON('["prioritized", "regression"]'), github.event.label.name) + run: | + gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + community_note: name: 'Add Community Note' runs-on: ubuntu-latest diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml index ce2d1025182c..a41805d73069 100644 --- a/.github/workflows/milestone.yml +++ b/.github/workflows/milestone.yml @@ -82,3 +82,18 @@ jobs: - name: 'Remove Label from Issues' run: | gh issue edit $(echo ${{ steps.get-issues.outputs.issues }} | jq --raw-output '.') --remove-label prioritized + + archive_and_unlabel: + name: 'Archive Project Items & Remove Label on Milestone Closed' + runs-on: ubuntu-latest + env: + MILESTONE: ${{ github.event.milestone.number }} + steps: + - name: 'Checkout Repo' + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + - name: 'Archive Project Items' + env: + GH_TOKEN: ${{ secrets.PROJECT_SCOPED_TOKEN }} + shell: bash + run: ./.ci/scripts/archive-on-milestone-closed.sh diff --git a/.github/workflows/new-project-automation.yml b/.github/workflows/new-project-automation.yml deleted file mode 100644 index 7aa4d8bdcf0c..000000000000 --- a/.github/workflows/new-project-automation.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Team GitHub Projects (new) Automation - -on: - issues: - types: ["labeled", "milestoned", "opened"] - pull_request_target: - types: ["labeled", "opened", "ready_for_review"] - -jobs: - community_check: - if: github.event_name == 'pull_request_target' - uses: ./.github/workflows/community-check.yml - secrets: inherit - with: - username: ${{ github.event.pull_request.user.login }} - - maintainer_prs: - name: Add Maintainer PRs that are Ready for Review - needs: community_check - if: needs.community_check.outputs.maintainer == 'true' && !github.event.pull_request.draft - uses: ./.github/workflows/reusable-team-project.yml - secrets: inherit - with: - status: ${{ vars.team_project_status_maintainer_pr }} - - partner_prs: - name: Add Partner PRs that are Ready for Review - if: github.event_name == 'pull_request_target' && !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'partner') - uses: ./.github/workflows/reusable-team-project.yml - secrets: inherit - - roadmap: - name: Add Roadmap Items - if: github.event.label.name == 'roadmap' || github.event.*.milestone.title == 'Roadmap' - uses: ./.github/workflows/reusable-team-project.yml - secrets: inherit - - regressions: - name: Add Regressions - if: github.event.label.name == 'regression' - uses: ./.github/workflows/reusable-team-project.yml - secrets: inherit diff --git a/.github/workflows/pull_request_target.yml b/.github/workflows/pull_request_target.yml index 69bdf8fa1508..0a0c661b51af 100644 --- a/.github/workflows/pull_request_target.yml +++ b/.github/workflows/pull_request_target.yml @@ -8,6 +8,7 @@ on: - edited - labeled - opened + - ready_for_review jobs: community_check: @@ -88,6 +89,48 @@ jobs: xl_label: 'size/XL' message_if_xl: '' + add_to_project: + name: 'Add to Project' + runs-on: ubuntu-latest + needs: community_check + env: + GH_TOKEN: ${{ secrets.PROJECT_SCOPED_TOKEN }} + # Some gh project calls take the project's ID, some take the project's number + PROJECT_ID: "PVT_kwDOAAuecM4AF-7h" + PROJECT_NUMBER: "196" + STATUS_FIELD_ID: "PVTSSF_lADOAAuecM4AF-7hzgDcsQA" + ITEM_URL: ${{ github.event.pull_request.html_url }} + steps: + - name: 'Add Ready Maintainer Pull Requests' + # This isn't pretty, but it ensures that we don't accidentally set the status on accident + if: contains(fromJSON('["opened", "ready_for_review"]'), github.event.action) && needs.community_check.outputs.maintainer == 'true' && !github.event.pull_request.draft + run: | + # In order to update the item's Status field, we need to capture the project item id from the output + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_maintainer_pr }} + + - name: 'Add When Assigned to Maintainers' + if: github.event.action == 'assigned' && needs.community_check.outputs.maintainer == 'true' + run: | + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_in_progress }} + + - name: 'Add Ready Partner Pull Requests' + # since we're not setting a status here, we don't need the ugly extra bit from above + if: contains(github.event.pull_request.labels.*.name, 'partner') && !github.event.pull_request.draft + run: | + gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + + - name: 'Add Ready External Maintainer Pull Requests' + if: contains(github.event.pull_request.labels.*.name, 'external-maintainer') && !github.event.pull_request.draft + run: | + gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + + - name: 'Add When Labeled Prioritized or Regression' + if: contains(fromJSON('["prioritized", "regression"]'), github.event.label.name) + run: | + gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + add_to_milestone: name: 'Add to Milestone' if: github.event.action == 'closed' && github.event.pull_request.merged From b2acac3ccfab437d6b9bd5c120d52e3206a24274 Mon Sep 17 00:00:00 2001 From: Justin Retzolk <44710313+justinretzolk@users.noreply.github.com> Date: Mon, 24 Jul 2023 12:36:20 -0500 Subject: [PATCH 2/6] Fix job name --- .github/workflows/milestone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml index a41805d73069..90421c132c42 100644 --- a/.github/workflows/milestone.yml +++ b/.github/workflows/milestone.yml @@ -84,7 +84,7 @@ jobs: gh issue edit $(echo ${{ steps.get-issues.outputs.issues }} | jq --raw-output '.') --remove-label prioritized archive_and_unlabel: - name: 'Archive Project Items & Remove Label on Milestone Closed' + name: 'Archive Project Items on Milestone Closed' runs-on: ubuntu-latest env: MILESTONE: ${{ github.event.milestone.number }} From 07b29bf5260f68e5ce69d9b37ee8fabbd57f3405 Mon Sep 17 00:00:00 2001 From: Justin Retzolk <44710313+justinretzolk@users.noreply.github.com> Date: Mon, 24 Jul 2023 13:05:02 -0500 Subject: [PATCH 3/6] Add update to View field --- .github/workflows/issues.yml | 8 ++++++-- .github/workflows/pull_request_target.yml | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 1dd199bc63c4..b78e52228d38 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -67,23 +67,27 @@ jobs: PROJECT_ID: "PVT_kwDOAAuecM4AF-7h" PROJECT_NUMBER: "196" STATUS_FIELD_ID: "PVTSSF_lADOAAuecM4AF-7hzgDcsQA" + VIEW_FIELD_ID: "PVTSSF_lADOAAuecM4AF-7hzgMRB34" ITEM_URL: ${{ github.event.issue.html_url }} steps: - name: 'Maintainer Issues' if: github.event.action == 'opened' && needs.community_check.outputs.maintainer == 'true' run: | - gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }}) + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} - name: 'Assigned to Maintainer' if: github.event.action == 'assigned' && needs.community_check.outputs.maintainer == 'true' run: | PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_in_progress }} + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} - name: 'Labeled Prioritized or Regression' if: contains(fromJSON('["prioritized", "regression"]'), github.event.label.name) run: | - gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }}) + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} community_note: name: 'Add Community Note' diff --git a/.github/workflows/pull_request_target.yml b/.github/workflows/pull_request_target.yml index 0a0c661b51af..28ffed773bde 100644 --- a/.github/workflows/pull_request_target.yml +++ b/.github/workflows/pull_request_target.yml @@ -99,6 +99,7 @@ jobs: PROJECT_ID: "PVT_kwDOAAuecM4AF-7h" PROJECT_NUMBER: "196" STATUS_FIELD_ID: "PVTSSF_lADOAAuecM4AF-7hzgDcsQA" + VIEW_FIELD_ID: "PVTSSF_lADOAAuecM4AF-7hzgMRB34" ITEM_URL: ${{ github.event.pull_request.html_url }} steps: - name: 'Add Ready Maintainer Pull Requests' @@ -108,28 +109,33 @@ jobs: # In order to update the item's Status field, we need to capture the project item id from the output PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_maintainer_pr }} + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} - name: 'Add When Assigned to Maintainers' if: github.event.action == 'assigned' && needs.community_check.outputs.maintainer == 'true' run: | PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_in_progress }} + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} - name: 'Add Ready Partner Pull Requests' # since we're not setting a status here, we don't need the ugly extra bit from above if: contains(github.event.pull_request.labels.*.name, 'partner') && !github.event.pull_request.draft run: | gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_partner_contribution }} - name: 'Add Ready External Maintainer Pull Requests' if: contains(github.event.pull_request.labels.*.name, 'external-maintainer') && !github.event.pull_request.draft run: | gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_external_maintainer }} - name: 'Add When Labeled Prioritized or Regression' if: contains(fromJSON('["prioritized", "regression"]'), github.event.label.name) run: | gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} add_to_milestone: name: 'Add to Milestone' From c726ccb53330c33bca63609939cb037877e48e28 Mon Sep 17 00:00:00 2001 From: Justin Retzolk <44710313+justinretzolk@users.noreply.github.com> Date: Mon, 24 Jul 2023 13:30:58 -0500 Subject: [PATCH 4/6] Add pull_request_review events --- .github/workflows/issues.yml | 6 ++++ .github/workflows/pull_request_review.yml | 41 +++++++++++++++++++++++ .github/workflows/pull_request_target.yml | 22 +++++++----- 3 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/pull_request_review.yml diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index b78e52228d38..50acfbce0373 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -89,6 +89,12 @@ jobs: PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }}) gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} + - name: 'Labeled Engineering Initiative' + if: github.event.label.name == 'engineering-initiative' + run: | + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }}) + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_engineering_initiative }} + community_note: name: 'Add Community Note' runs-on: ubuntu-latest diff --git a/.github/workflows/pull_request_review.yml b/.github/workflows/pull_request_review.yml new file mode 100644 index 000000000000..dd11d81a0ab4 --- /dev/null +++ b/.github/workflows/pull_request_review.yml @@ -0,0 +1,41 @@ +name: Process pull_request_review Events + +on: + pull_request_review: + types: + - submitted + +jobs: + community_check: + name: 'Community Check' + uses: ./.github/workflows/community-check.yml + secrets: inherit + with: + username: ${{ github.event.review.user.login }} + + add_to_project: + name: 'Add to Project' + runs-on: ubuntu-latest + needs: community_check + env: + GH_TOKEN: ${{ secrets.PROJECT_SCOPED_TOKEN }} + # Some gh project calls take the project's ID, some take the project's number + PROJECT_ID: "PVT_kwDOAAuecM4AF-7h" + PROJECT_NUMBER: "196" + STATUS_FIELD_ID: "PVTSSF_lADOAAuecM4AF-7hzgDcsQA" + VIEW_FIELD_ID: "PVTSSF_lADOAAuecM4AF-7hzgMRB34" + ITEM_URL: ${{ github.event.pull_request.html_url }} + steps: + - name: 'Pull Requests Approved By Maintainers' + if: github.event.review.state == 'APPROVED' && needs.community_check.outputs.maintainer == 'true' + run: | + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_pending_merge }} + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} + + - name: 'Pull Requests With Changes Requested by Maintainers' + if: github.event.review.state == 'CHANGES_REQUESTED' && needs.community_check.outputs.maintainer == 'true' + run: | + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_waiting }} + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} diff --git a/.github/workflows/pull_request_target.yml b/.github/workflows/pull_request_target.yml index 28ffed773bde..e511a3a66704 100644 --- a/.github/workflows/pull_request_target.yml +++ b/.github/workflows/pull_request_target.yml @@ -102,7 +102,7 @@ jobs: VIEW_FIELD_ID: "PVTSSF_lADOAAuecM4AF-7hzgMRB34" ITEM_URL: ${{ github.event.pull_request.html_url }} steps: - - name: 'Add Ready Maintainer Pull Requests' + - name: 'Ready Maintainer Pull Requests' # This isn't pretty, but it ensures that we don't accidentally set the status on accident if: contains(fromJSON('["opened", "ready_for_review"]'), github.event.action) && needs.community_check.outputs.maintainer == 'true' && !github.event.pull_request.draft run: | @@ -111,32 +111,38 @@ jobs: gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_maintainer_pr }} gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} - - name: 'Add When Assigned to Maintainers' + - name: 'Assigned to Maintainers' if: github.event.action == 'assigned' && needs.community_check.outputs.maintainer == 'true' run: | PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_in_progress }} gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} - - name: 'Add Ready Partner Pull Requests' + - name: 'Ready Partner Pull Requests' # since we're not setting a status here, we don't need the ugly extra bit from above if: contains(github.event.pull_request.labels.*.name, 'partner') && !github.event.pull_request.draft run: | - gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }}) gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_partner_contribution }} - - name: 'Add Ready External Maintainer Pull Requests' + - name: 'Ready External Maintainer Pull Requests' if: contains(github.event.pull_request.labels.*.name, 'external-maintainer') && !github.event.pull_request.draft run: | - gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }}) gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_external_maintainer }} - - name: 'Add When Labeled Prioritized or Regression' + - name: 'Labeled Prioritized or Regression' if: contains(fromJSON('["prioritized", "regression"]'), github.event.label.name) run: | - gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }}) gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} + - name: 'Labeled Engineering Initiative' + if: github.event.label.name == 'engineering-initiative' + run: | + PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }}) + gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_engineering_initiative }} + add_to_milestone: name: 'Add to Milestone' if: github.event.action == 'closed' && github.event.pull_request.merged From f32d643ec6498d02bc65ebb5429603fc11544a2a Mon Sep 17 00:00:00 2001 From: Justin Retzolk <44710313+justinretzolk@users.noreply.github.com> Date: Mon, 24 Jul 2023 14:12:09 -0500 Subject: [PATCH 5/6] Remove Waiting on Maintainer requests changes --- .github/workflows/pull_request_review.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/pull_request_review.yml b/.github/workflows/pull_request_review.yml index dd11d81a0ab4..67811207327a 100644 --- a/.github/workflows/pull_request_review.yml +++ b/.github/workflows/pull_request_review.yml @@ -32,10 +32,3 @@ jobs: PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_pending_merge }} gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} - - - name: 'Pull Requests With Changes Requested by Maintainers' - if: github.event.review.state == 'CHANGES_REQUESTED' && needs.community_check.outputs.maintainer == 'true' - run: | - PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }} | jq '.id') - gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.STATUS_FIELD_ID }} --single-select-option-id ${{ vars.team_project_status_waiting }} - gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} From 162cf0b5a70492bf5459d3c206f7d6add54f1c1a Mon Sep 17 00:00:00 2001 From: Justin Retzolk <44710313+justinretzolk@users.noreply.github.com> Date: Mon, 24 Jul 2023 14:15:23 -0500 Subject: [PATCH 6/6] Remove outdate comment --- .github/workflows/pull_request_target.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pull_request_target.yml b/.github/workflows/pull_request_target.yml index e511a3a66704..26f942766c8c 100644 --- a/.github/workflows/pull_request_target.yml +++ b/.github/workflows/pull_request_target.yml @@ -119,7 +119,6 @@ jobs: gh project item-edit --id "$PROJECT_ITEM_ID" --project-id ${{ env.PROJECT_ID }} --field-id ${{ env.VIEW_FIELD_ID }} --single-select-option-id ${{ vars.team_project_view_working_board }} - name: 'Ready Partner Pull Requests' - # since we're not setting a status here, we don't need the ugly extra bit from above if: contains(github.event.pull_request.labels.*.name, 'partner') && !github.event.pull_request.draft run: | PROJECT_ITEM_ID=$(gh project item-add ${{ env.PROJECT_NUMBER }} --owner "hashicorp" --url ${{ env.ITEM_URL }})