From d1a90942856295d4a9607d3f8b1defddfea31083 Mon Sep 17 00:00:00 2001 From: Ben Jarmak Date: Thu, 31 Aug 2023 11:09:57 -0500 Subject: [PATCH 01/10] [skip ci] Initial commit of Project Automations --- .github/ISSUE_TEMPLATE/bug_report.yml | 16 +- .github/ISSUE_TEMPLATE/feature_request.yml | 7 - .../project_automation_set_in_progress.yml | 367 ++++++++++++++++++ .../project_automation_set_in_review.yml | 169 ++++++++ .../project_automation_set_roadmap.yml | 170 ++++++++ .../project_automation_sync_pr_issues.yml | 241 ++++++++++++ 6 files changed, 962 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/project_automation_set_in_progress.yml create mode 100644 .github/workflows/project_automation_set_in_review.yml create mode 100644 .github/workflows/project_automation_set_roadmap.yml create mode 100644 .github/workflows/project_automation_sync_pr_issues.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 05fee9ebca..17d115ecec 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -29,7 +29,7 @@ body: attributes: label: Version description: What version of Morpheus are you running? - placeholder: "example: 22.09" + placeholder: "example: 23.11" validations: required: true @@ -42,6 +42,7 @@ body: - Docker - Conda - Source + - Kubernetes - type: textarea id: description @@ -65,6 +66,12 @@ body: label: Relevant log output description: Please paste relevant error and log output here render: shell + value: | +
Click here to see error details
+
+        [Paste the error here, it will be hidden by default]
+
+       
- type: textarea id: env-printout @@ -72,6 +79,13 @@ body: label: Full env printout description: Please run and paste the output of the `./external/utilities/scripts/print_env.sh` script here, to gather any other relevant environment details render: shell + value: | +
Click here to see environment details
+
+        [Paste the results of print_env.sh here, it will be hidden by default]
+
+       
+ - type: textarea id: misc diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 57c7433797..116f3e7790 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -70,13 +70,6 @@ body: validations: required: true - - type: textarea - id: alternatives - attributes: - label: Describe any alternatives you have considered - description: List any other libraries, or approaches you have looked at or tried. - placeholder: I have looked at library xyz and qrs, but they do not offer GPU accleration - - type: textarea id: misc attributes: diff --git a/.github/workflows/project_automation_set_in_progress.yml b/.github/workflows/project_automation_set_in_progress.yml new file mode 100644 index 0000000000..f654e70673 --- /dev/null +++ b/.github/workflows/project_automation_set_in_progress.yml @@ -0,0 +1,367 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Set PR and Linked Issues to In Progress + +on: + pull_request_target: + # Run this action when a PR is opened or edited + # Issues do not have a graphQL connection to linked PRs so we can't use that event + types: [opened, converted_to_draft] + pull_request_review: + # Run this action when a PR is reviewed + types: [submitted] + +env: + ORG: ${{ github.event.repository.owner.login }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.event.repository.name }} + PR_GLOBAL_ID: ${{ github.event.pull_request.node_id}} + + # The environment vars below are hard-coded from external queries to save time + complexity here + # Note: PVT means Project V2, not "Private" + # PVT = Project V2, PVTSSF = Project V2 Single Select Field, PVTIF = Project V2 Iteration Field + PROJECT_ID: "PVT_kwDOBkAsks4ACeio" + STATUS_FIELD_ID: "PVTSSF_lADOBkAsks4ACeiozgBbno0" + WORKING_SPRINT_FIELD_ID: "PVTIF_lADOBkAsks4ACeiozgJ_KCY" + START_SPRINT_FIELD_ID: "PVTIF_lADOBkAsks4ACeiozgI90p0" + IN_PROGRESS_PROJECT_OPTION_ID: "47fc9ee4" + IN_REVIEW_PROJECT_OPTION_ID: "eb7a6302" + +jobs: + query_and_mutate_project_fields: + runs-on: ubuntu-latest + + # We use the default GitHub token to perform the draft update because + # The pull_request_review trigger does not grant access to the secrets.PROJECT_MANAGEMENT_PAT + permissions: + issues: write + pull-requests: write + + steps: + - name: Check if changes requested from a reviewer + id: check_changes_requested + if: github.event_name == 'pull_request_review' + run: | + if [ ${{ github.event.review.state }} != 'changes_requested' ]; then + echo "Changes not requested, exiting" + exit 0 + + # If it is requesting changes, set PR to draft + # We use the default token here since we're granting write access to the PR + elif [ ${{ github.event.pull_request.draft }} == true ]; then + gh api graphql -f query=' + mutation { + convertPullRequestToDraft(input: {pullRequestId: "${{ env.PR_GLOBAL_ID }}"}) { + clientMutationId + } + }' + exit 0 + fi + continue-on-error: true + + - name: Wait 1 Second + id: sleep + if: github.event_name == 'pull_request_target' + run: sleep 1 # We sleep here to ensure the pr is added to the project before we query for it + + - name: Select Status Field Value + id: select_status_field_value + if: github.event_name == 'pull_request_target' + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # If it's not a draft and it's an opened trigger, the status should be "Ready for Review", otherwise "In Progress" + if [ ${{ github.event.pull_request.draft }} == false ] && [ ${{ github.event.action }} == "opened" ]; then + echo "PR is not a draft, setting status to 'In Review'" + echo "STATUS_OPTION_ID=$IN_REVIEW_PROJECT_OPTION_ID" >> $GITHUB_ENV + else + echo "PR is a draft, setting status to 'In Progress'" + echo "STATUS_OPTION_ID=$IN_PROGRESS_PROJECT_OPTION_ID" >> $GITHUB_ENV + fi + continue-on-error: true + + - name: Get PR Project ID + id: get_pr_id + if: github.event_name == 'pull_request_target' + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Query up to 10 projects for the PR + gh api graphql -f query=' + query { + organization(login: "${{ env.ORG }}") { + repository(name: "${{ env.REPO }}") { + issueOrPullRequest(number: ${{ env.PR_NUMBER }}) { + ... on PullRequest { + id + projectItems(first: 10) { + edges { + node { + id + project { + id + } + } + } + } + } + } + } + } + }' > project_data.json + + # Filter the json result to only the project-specific ID for the PR + # A PR can be in multiple projects so we need to filter by the project ID we want + pr_id=$(jq -r '.data.organization.repository.issueOrPullRequest.projectItems.edges[] | + select(.node.project.id == "${{ env.PROJECT_ID }}") | + .node.id' project_data.json) + echo "PR_ID=$pr_id" >> $GITHUB_ENV + continue-on-error: true + + - name: Set PR Fields + id: set_pr_fields + if: github.event_name == 'pull_request_target' + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + gh api graphql -f query=' + mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: "${{ env.PROJECT_ID }}" + itemId: "${{ env.PR_ID }}" + fieldId: "${{ env.STATUS_FIELD_ID }}" + value: { + singleSelectOptionId: "${{ env.STATUS_OPTION_ID }}" + } + } + ) { + projectV2Item { + id + } + } + }' + + # Check if the PR has a start sprint assigned, save the result for the linked issues + gh api graphql -f query=' + query { + node(id: "${{ env.PR_ID }}") { + ... on ProjectV2Item { + id + fieldValueByName(name: "Start Sprint") { + ... on ProjectV2ItemFieldIterationValue { + id + } + } + } + } + }' > start_sprint_exists_data.json + start_sprint_option_id=$(jq -r '.data.node.fieldValueByName.id' start_sprint_exists_data.json) + echo "START_SPRINT_OPTION_ID=$start_sprint_option_id" >> $GITHUB_ENV + + # If there is no start sprint assigned, assign the current start sprint + if [ "$start_sprint_option_id" == 'null' ]; then + # Get current start sprint iteration id + # The current sprint is always the first iteration in the list + gh api graphql -f query=' + query MyQuery { + node(id: "${{ env.PROJECT_ID }}") { + ... on ProjectV2 { + id + field(name: "Start Sprint") { + ... on ProjectV2IterationField { + id + name + configuration { + iterations { + id + } + } + } + } + } + } + }' > start_sprint_option_data.json + current_start_sprint_option_id=$(jq -r '.data.node.field.configuration.iterations[0].id' start_sprint_option_data.json) + echo "CURRENT_START_SPRINT_OPTION_ID=$current_start_sprint_option_id" >> $GITHUB_ENV + + # The query below is constructed differently than the ones above due to bash variable syntax + github actions syntax interactions + QUERY="mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: \"$PROJECT_ID\" + itemId: \"$PR_ID\" + fieldId: \"$START_SPRINT_FIELD_ID\" + value: { + iterationId: \"$current_start_sprint_option_id\" + } + } + ) { + projectV2Item { + id + } + } + }" + gh api graphql --field query="$QUERY" + fi + + # Assign the current working sprint to the PR (faster/simpler to just overwrite even if it is the same) + gh api graphql -f query=' + query { + node(id: "${{ env.PROJECT_ID }}") { + ... on ProjectV2 { + id + field(name: "Working Sprint") { + ... on ProjectV2IterationField { + id + name + configuration { + iterations { + id + } + } + } + } + } + } + }' > working_sprint_options_data.json + current_working_sprint_option_id=$(jq -r '.data.node.field.configuration.iterations[0].id' working_sprint_options_data.json) + echo "CURRENT_WORKING_SPRINT_OPTION_ID=$current_working_sprint_option_id" >> $GITHUB_ENV + + # Set the working sprint to the current working sprint + QUERY="mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: \"$PROJECT_ID\" + itemId: \"$PR_ID\" + fieldId: \"$WORKING_SPRINT_FIELD_ID\" + value: { + iterationId: \"$current_working_sprint_option_id\" + } + } + ) { + projectV2Item { + id + } + } + }" + gh api graphql --field query="$QUERY" + continue-on-error: true + + - name: Sync Linked Issues + id: sync_linked_issues + if: github.event_name == 'pull_request_target' + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Find the linked issues to the PR + gh api graphql -f query=' + query { + organization(login: "${{ env.ORG }}") { + repository(name: "${{ env.REPO }}") { + issueOrPullRequest(number: ${{ env.PR_NUMBER }}) { + ... on PullRequest { + id + closingIssuesReferences(first: 10) { + edges { + node { + id + projectItems(first: 10) { + nodes { + id + } + edges { + node { + id + project { + id + } + } + } + } + } + } + } + } + } + } + } + }' > linked_issues.json + issue_ids=$(jq -r '.data.organization.repository.issueOrPullRequest.closingIssuesReferences.edges[].node.projectItems.edges[] | + select(.node.project.id == "${{ env.PROJECT_ID }}") | + .node.id' linked_issues.json) + + # For each linked issue, set the status to "In Progress", the Working Sprint to the current working sprint + # If there's no Start Sprint, set that to the current Start Sprint as well + for issue_id in $issue_ids; do + # Set the status of the linked issues to "In Progress" + QUERY="mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: \"$PROJECT_ID\" + itemId: \"$issue_id\" + fieldId: \"$STATUS_FIELD_ID\" + value: { + singleSelectOptionId: \"$STATUS_OPTION_ID\" + } + } + ) { + projectV2Item { + id + } + } + }" + gh api graphql --field query="$QUERY" + # Set the working sprint of the linked issues to the current working sprint + QUERY="mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: \"$PROJECT_ID\" + itemId: \"$issue_id\" + fieldId: \"$WORKING_SPRINT_FIELD_ID\" + value: { + iterationId: \"$CURRENT_WORKING_SPRINT_OPTION_ID\" + } + } + ) { + projectV2Item { + id + } + } + }" + gh api graphql --field query="$QUERY" + # Set the start sprint of the linked issues to the current start sprint if it's null + if [ ${{ env.START_SPRINT_OPTION_ID }} == 'null' ]; then + QUERY="mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: \"$PROJECT_ID\" + itemId: \"$issue_id\" + fieldId: \"$START_SPRINT_FIELD_ID\" + value: { + iterationId: \"$CURRENT_START_SPRINT_OPTION_ID\" + } + } + ) { + projectV2Item { + id + } + } + }" + gh api graphql --field query="$QUERY" + fi + done + continue-on-error: true diff --git a/.github/workflows/project_automation_set_in_review.yml b/.github/workflows/project_automation_set_in_review.yml new file mode 100644 index 0000000000..7b6aa8aef7 --- /dev/null +++ b/.github/workflows/project_automation_set_in_review.yml @@ -0,0 +1,169 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Set PR and Linked Issues to In Review + +on: + pull_request_target: + # Run this action when a PR is opened or edited + # Issues do not have a graphQL connection to linked PRs so we can't use that event + types: [ready_for_review] + +env: + ORG: ${{ github.event.repository.owner.login }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.event.repository.name }} + + # The environment vars below are hard-coded from external queries to save time + complexity here + # Note: PVT means Project V2, not "Private" + # PVT = Project V2, PVTSSF = Project V2 Single Select Field, PVTIF = Project V2 Iteration Field + PROJECT_ID: "PVT_kwDOBkAsks4ACeio" + STATUS_FIELD_ID: "PVTSSF_lADOBkAsks4ACeiozgBbno0" + IN_REVIEW_PROJECT_OPTION_ID: "eb7a6302" + +jobs: + query_and_mutate_project_fields: + runs-on: ubuntu-latest + + steps: + - name: Wait 1 Second + id: sleep + run: sleep 1 + + - name: Get PR Project ID + id: get_pr_id + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Query up to 10 projects for the PR + gh api graphql -f query=' + query { + organization(login: "${{ env.ORG }}") { + repository(name: "${{ env.REPO }}") { + issueOrPullRequest(number: ${{ env.PR_NUMBER }}) { + ... on PullRequest { + id + projectItems(first: 10) { + edges { + node { + id + project { + id + } + } + } + } + } + } + } + } + }' > project_data.json + + # Filter the json result to only the project-specific ID for the PR + # A PR can be in multiple projects so we need to filter by the project ID we want + pr_id=$(jq -r '.data.organization.repository.issueOrPullRequest.projectItems.edges[] | + select(.node.project.id == "${{ env.PROJECT_ID }}") | + .node.id' project_data.json) + echo "PR_ID=$pr_id" >> $GITHUB_ENV + continue-on-error: true + + - name: Set PR to In Review + id: set_pr_in_review + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Update the PR status to In Review + gh api graphql -f query=' + mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: "${{ env.PROJECT_ID }}" + itemId: "${{ env.PR_ID }}" + fieldId: "${{ env.STATUS_FIELD_ID }}" + value: { + singleSelectOptionId: "${{ env.IN_REVIEW_PROJECT_OPTION_ID }}" + } + } + ) { + projectV2Item { + id + } + } + }' + continue-on-error: true + + - name: Set Linked Issues to In Review + id: update_linked_issues + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + gh api graphql -f query=' + query { + organization(login: "${{ env.ORG }}") { + repository(name: "${{ env.REPO }}") { + issueOrPullRequest(number: ${{ env.PR_NUMBER }}) { + ... on PullRequest { + id + closingIssuesReferences(first: 10) { + edges { + node { + id + projectItems(first: 10) { + nodes { + id + } + edges { + node { + id + project { + id + } + } + } + } + } + } + } + } + } + } + } + }' > linked_issue_data.json + issue_ids=$(jq -r '.data.organization.repository.issueOrPullRequest.closingIssuesReferences.edges[].node.projectItems.edges[] | + select(.node.project.id == "${{ env.PROJECT_ID }}") | + .node.id' linked_issue_data.json) + + # Set Linked Issues to In Review + for issue_id in $issue_ids; do + # The query below is constructed differently than the others due to bash variable syntax + github actions syntax interactions + QUERY="mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: \"$PROJECT_ID\" + itemId: \"$issue_id\" + fieldId: \"$STATUS_FIELD_ID\" + value: { + singleSelectOptionId: \"$IN_REVIEW_PROJECT_OPTION_ID\" + } + } + ) { + projectV2Item { + id + } + } + }" + gh api graphql --field query="$QUERY" + done + continue-on-error: true diff --git a/.github/workflows/project_automation_set_roadmap.yml b/.github/workflows/project_automation_set_roadmap.yml new file mode 100644 index 0000000000..e28103fccb --- /dev/null +++ b/.github/workflows/project_automation_set_roadmap.yml @@ -0,0 +1,170 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Set PR or Issue Roadmap Value on Close + +on: + pull_request_target: + # Run this action when a PR is closed + types: [closed] + issues: + # Run this action when an issue is closed + types: [closed] + +env: + ORG: ${{ github.event.repository.owner.login }} + PR_NUMBER: ${{ github.event.pull_request.number }} # evaluates to null for issues + ISSUE_NUMBER: ${{ github.event.issue.number }} # evaluates to null for PRs + REPO: ${{ github.event.repository.name }} + + # The environment vars below are hard-coded from external queries to save time + complexity here + # Note: PVT means Project V2, not "Private" + # PVT = Project V2, PVTSSF = Project V2 Single Select Field, PVTIF = Project V2 Iteration Field + PROJECT_ID: "PVT_kwDOBkAsks4ACeio" + ROADMAP_FIELD_ID: "PVTSSF_lADOBkAsks4ACeiozgCCFL4" + +jobs: + query_and_mutate_project_fields: + runs-on: ubuntu-latest + + steps: + - name: Get PR Project ID + if: github.event_name == 'pull_request_target' + id: get_pr_id + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Query up to 10 projects for the PR + gh api graphql -f query=' + query { + organization(login: "${{ env.ORG }}") { + repository(name: "${{ env.REPO }}") { + issueOrPullRequest(number: ${{ env.PR_NUMBER }}) { + ... on PullRequest { + id + projectItems(first: 10) { + edges { + node { + id + project { + id + } + } + } + } + } + } + } + } + }' > project_data.json + + # Filter the json result to only the project-specific ID for the PR + # A PR can be in multiple projects so we need to filter by the project ID we want + pr_id=$(jq -r '.data.organization.repository.issueOrPullRequest.projectItems.edges[] | + select(.node.project.id == "${{ env.PROJECT_ID }}") | + .node.id' project_data.json) + echo "ITEM_ID=$pr_id" >> $GITHUB_ENV + continue-on-error: true + + - name: Get Issue Project ID + if: github.event_name == 'issues' + id: get_issue_id + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Query up to 10 projects for the Issue + gh api graphql -f query=' + query { + organization(login: "${{ env.ORG }}") { + repository(name: "${{ env.REPO }}") { + issueOrPullRequest(number: ${{ env.ISSUE_NUMBER }}) { + ... on Issue { + id + projectItems(first: 10) { + edges { + node { + id + project { + id + } + } + } + } + } + } + } + } + }' > project_data.json + + # Filter the json result to only the project-specific ID for the PR + # A PR can be in multiple projects so we need to filter by the project ID we want + issue_id=$(jq -r '.data.organization.repository.issueOrPullRequest.projectItems.edges[] | + select(.node.project.id == "${{ env.PROJECT_ID }}") | + .node.id' project_data.json) + echo "ITEM_ID=$issue_id" >> $GITHUB_ENV + continue-on-error: true + + - name: Get Current Release + id: get_current_release + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Get current roadmap id + # We maintain the roadmap as a single select field in the project, with the first value being the upcoming release + + gh api graphql -f query=' + query MyQuery { + node(id: "${{ env.PROJECT_ID }}") { + ... on ProjectV2 { + id + field(name: "Roadmap") { + ... on ProjectV2SingleSelectField { + id + options { + id + } + } + } + } + } + }' > roadmap_option_data.json + current_roadmap_option_id=$(jq -r '.data.node.field.options[0].id' roadmap_option_data.json) + echo "CURRENT_ROADMAP_OPTION_ID=$current_roadmap_option_id" >> $GITHUB_ENV + continue-on-error: true + + - name: Set Item Roadmap + id: set_item_roadmap + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Perform the mutation to update the Roadmap + gh api graphql -f query=' + mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: "${{ env.PROJECT_ID }}" + itemId: "${{ env.ITEM_ID }}" + fieldId: "${{ env.ROADMAP_FIELD_ID }}" + value: { + singleSelectOptionId: "${{ env.CURRENT_ROADMAP_OPTION_ID }}" + } + } + ) { + projectV2Item { + id + } + } + }' + continue-on-error: true diff --git a/.github/workflows/project_automation_sync_pr_issues.yml b/.github/workflows/project_automation_sync_pr_issues.yml new file mode 100644 index 0000000000..e53b091e49 --- /dev/null +++ b/.github/workflows/project_automation_sync_pr_issues.yml @@ -0,0 +1,241 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Synchronize Linked Issues + +on: + pull_request_target: + # Run this action when a PR is opened or edited + # Issues do not have a graphQL connection to linked PRs so we can't use that event + types: [edited] + +env: + ORG: ${{ github.event.repository.owner.login }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.event.repository.name }} + + # The environment vars below are hard-coded from external queries to save time + complexity here + # Note: PVT means Project V2, not "Private" + PROJECT_ID: "PVT_kwDOBkAsks4ACeio" + STATUS_FIELD_ID: "PVTSSF_lADOBkAsks4ACeiozgBbno0" + WORKING_SPRINT_FIELD_ID: "PVTIF_lADOBkAsks4ACeiozgJ_KCY" + START_SPRINT_FIELD_ID: "PVTIF_lADOBkAsks4ACeiozgI90p0" + +jobs: + query_and_mutate_project_fields: + runs-on: ubuntu-latest + + steps: + - name: Wait 1 Second + id: sleep + run: sleep 1 + + - name: Get PR Project ID + id: get_pr_id + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Query up to 10 projects for the PR + gh api graphql -f query=' + query { + organization(login: "${{ env.ORG }}") { + repository(name: "${{ env.REPO }}") { + issueOrPullRequest(number: ${{ env.PR_NUMBER }}) { + ... on PullRequest { + id + projectItems(first: 10) { + edges { + node { + id + project { + id + } + } + } + } + } + } + } + } + }' > project_data.json + + # Filter the json result to only the project-specific ID for the PR + # A PR can be in multiple projects so we need to filter by the project ID we want + pr_id=$(jq -r '.data.organization.repository.issueOrPullRequest.projectItems.edges[] | + select(.node.project.id == "${{ env.PROJECT_ID }}") | + .node.id' project_data.json) + echo "PR_ID=$pr_id" >> $GITHUB_ENV + continue-on-error: true + + - name: Get Status, Start Sprint, and Working Sprint Fields from the PR + id: get_pr_status + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + # Query the PR's status from the project + gh api graphql -f query=' + query { + node(id: "${{ env.PR_ID }}") { + ... on ProjectV2Item { + id + fieldValueByName(name: "Status") { + ... on ProjectV2ItemFieldSingleSelectValue { + id + } + } + } + } + }' > status_field_data.json + status_option_id=$(jq -r '.data.node.fieldValueByName.id' project_data.json) + echo "STATUS_OPTION_ID=$status_option_id" >> $GITHUB_ENV + + # Query the PR's start sprint from the project + gh api graphql -f query=' + query { + node(id: "${{ env.PR_ID }}") { + ... on ProjectV2Item { + id + fieldValueByName(name: "Start Sprint") { + ... on ProjectV2ItemFieldIterationValue { + id + } + } + } + } + }' > start_sprint_data.json + start_sprint_option_id=$(jq -r '.data.node.fieldValueByName.id' start_sprint_data.json) + echo "START_SPRINT_OPTION_ID=$start_sprint_option_id" >> $GITHUB_ENV + + # Query the PR's working sprint from the project + gh api graphql -f query=' + query { + node(id: "${{ env.PR_ID }}") { + ... on ProjectV2Item { + id + fieldValueByName(name: "Working Sprint") { + ... on ProjectV2ItemFieldIterationValue { + id + } + } + } + } + }' > working_sprint_data.json + working_sprint_option_id=$(jq -r '.data.node.fieldValueByName.id' working_sprint_data.json) + echo "WORKING_SPRINT_OPTION_ID=$working_sprint_option_id" >> $GITHUB_ENV + + continue-on-error: true + + - name: Sync Linked Issues + id: update_linked_issues + env: + GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + run: | + gh api graphql -f query=' + query { + organization(login: "${{ env.ORG }}") { + repository(name: "${{ env.REPO }}") { + issueOrPullRequest(number: ${{ env.PR_NUMBER }}) { + ... on PullRequest { + id + closingIssuesReferences(first: 10) { + edges { + node { + id + projectItems(first: 10) { + nodes { + id + } + edges { + node { + id + project { + id + } + } + } + } + } + } + } + } + } + } + } + }' > project_data.json + issue_ids=$(jq -r '.data.organization.repository.issueOrPullRequest.closingIssuesReferences.edges[].node.projectItems.edges[] | + select(.node.project.id == "${{ env.PROJECT_ID }}") | + .node.id' project_data.json) + + for issue_id in $issue_ids; do + # The query below is constructed differently than the others due to bash variable syntax + github actions syntax interactions + # Update Status + QUERY="mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: \"$PROJECT_ID\" + itemId: \"$issue_id\" + fieldId: \"$STATUS_FIELD_ID\" + value: { + singleSelectOptionId: \"$STATUS_OPTION_ID\" + } + } + ) { + projectV2Item { + id + } + } + }" + gh api graphql --field query="$QUERY" + + # Update Start Sprint + QUERY="mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: \"$PROJECT_ID\" + itemId: \"$issue_id\" + fieldId: \"$START_SPRINT_FIELD_ID\" + value: { + iterationId: \"$START_SPRINT_OPTION_ID\" + } + } + ) { + projectV2Item { + id + } + } + }" + gh api graphql --field query="$QUERY" + + # Update Working Sprint + QUERY="mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: \"$PROJECT_ID\" + itemId: \"$issue_id\" + fieldId: \"$WORKING_SPRINT_FIELD_ID\" + value: { + iterationId: \"$WORKING_SPRINT_OPTION_ID\" + } + } + ) { + projectV2Item { + id + } + } + }" + gh api graphql --field query="$QUERY" + + done + continue-on-error: true From 45b28431ca517ee7167e8736771d73e9d8a1f7da Mon Sep 17 00:00:00 2001 From: Ben Jarmak Date: Thu, 31 Aug 2023 11:12:11 -0500 Subject: [PATCH 02/10] [skip ci] drop shell renderer for collapsible part --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 17d115ecec..eda20d7f4a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -65,7 +65,6 @@ body: attributes: label: Relevant log output description: Please paste relevant error and log output here - render: shell value: |
Click here to see error details
 
@@ -78,7 +77,6 @@ body:
     attributes:
       label: Full env printout
       description: Please run and paste the output of the `./external/utilities/scripts/print_env.sh` script here, to gather any other relevant environment details
-      render: shell
       value: |
        
Click here to see environment details
 

From d8188975763a282dcec6a722675672124af69357 Mon Sep 17 00:00:00 2001
From: Ben Jarmak 
Date: Thu, 31 Aug 2023 11:42:12 -0500
Subject: [PATCH 03/10] [skip ci] Add more descriptive job names

---
 .github/workflows/project_automation_set_in_progress.yml | 2 +-
 .github/workflows/project_automation_set_in_review.yml   | 2 +-
 .github/workflows/project_automation_set_roadmap.yml     | 2 +-
 .github/workflows/project_automation_sync_pr_issues.yml  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/project_automation_set_in_progress.yml b/.github/workflows/project_automation_set_in_progress.yml
index f654e70673..d05d997566 100644
--- a/.github/workflows/project_automation_set_in_progress.yml
+++ b/.github/workflows/project_automation_set_in_progress.yml
@@ -41,7 +41,7 @@ env:
  IN_REVIEW_PROJECT_OPTION_ID: "eb7a6302"
 
 jobs:
-  query_and_mutate_project_fields:
+  project_automation_in_progress:
     runs-on: ubuntu-latest
 
     # We use the default GitHub token to perform the draft update because
diff --git a/.github/workflows/project_automation_set_in_review.yml b/.github/workflows/project_automation_set_in_review.yml
index 7b6aa8aef7..a02c93400b 100644
--- a/.github/workflows/project_automation_set_in_review.yml
+++ b/.github/workflows/project_automation_set_in_review.yml
@@ -34,7 +34,7 @@ env:
  IN_REVIEW_PROJECT_OPTION_ID: "eb7a6302"
 
 jobs:
-  query_and_mutate_project_fields:
+  project_automation_in_review:
     runs-on: ubuntu-latest
     
     steps:
diff --git a/.github/workflows/project_automation_set_roadmap.yml b/.github/workflows/project_automation_set_roadmap.yml
index e28103fccb..b41a636d15 100644
--- a/.github/workflows/project_automation_set_roadmap.yml
+++ b/.github/workflows/project_automation_set_roadmap.yml
@@ -36,7 +36,7 @@ env:
  ROADMAP_FIELD_ID: "PVTSSF_lADOBkAsks4ACeiozgCCFL4"
 
 jobs:
-  query_and_mutate_project_fields:
+  project_automation_roadmap_on_close:
     runs-on: ubuntu-latest
     
     steps:        
diff --git a/.github/workflows/project_automation_sync_pr_issues.yml b/.github/workflows/project_automation_sync_pr_issues.yml
index e53b091e49..a0ecfd96ed 100644
--- a/.github/workflows/project_automation_sync_pr_issues.yml
+++ b/.github/workflows/project_automation_sync_pr_issues.yml
@@ -34,7 +34,7 @@ env:
  START_SPRINT_FIELD_ID: "PVTIF_lADOBkAsks4ACeiozgI90p0"
 
 jobs:
-  query_and_mutate_project_fields:
+  project_automation_sync_pr_with_issues:
     runs-on: ubuntu-latest
 
     steps:

From 144a3f796bc34f1fafa4e0e94711987a8adbf47a Mon Sep 17 00:00:00 2001
From: Ben Jarmak 
Date: Thu, 31 Aug 2023 11:53:56 -0500
Subject: [PATCH 04/10] [skip ci] more accurate echo

---
 .github/workflows/project_automation_set_in_progress.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/project_automation_set_in_progress.yml b/.github/workflows/project_automation_set_in_progress.yml
index d05d997566..39edbeb8c6 100644
--- a/.github/workflows/project_automation_set_in_progress.yml
+++ b/.github/workflows/project_automation_set_in_progress.yml
@@ -85,10 +85,10 @@ jobs:
         run: |
           # If it's not a draft and it's an opened trigger, the status should be "Ready for Review", otherwise "In Progress"
           if [ ${{ github.event.pull_request.draft }} == false ] && [ ${{ github.event.action }} == "opened" ]; then
-            echo "PR is not a draft, setting status to 'In Review'"
+            echo "Setting status to 'In Review'"
             echo "STATUS_OPTION_ID=$IN_REVIEW_PROJECT_OPTION_ID" >> $GITHUB_ENV
           else
-            echo "PR is a draft, setting status to 'In Progress'"
+            echo "Setting status to 'In Progress'"
             echo "STATUS_OPTION_ID=$IN_PROGRESS_PROJECT_OPTION_ID" >> $GITHUB_ENV
           fi
         continue-on-error: true

From 55247286e8962fdb57426276d7d783384f00fd6a Mon Sep 17 00:00:00 2001
From: Ben Jarmak 
Date: Thu, 31 Aug 2023 11:55:32 -0500
Subject: [PATCH 05/10] [skip ci] remove extra newline in bug_report form

---
 .github/ISSUE_TEMPLATE/bug_report.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index eda20d7f4a..3d3a427857 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -84,7 +84,6 @@ body:
 
        
- - type: textarea id: misc attributes: From 328913e18e45ae16e4aa42baab4ab5042097d9ec Mon Sep 17 00:00:00 2001 From: Ben Jarmak Date: Fri, 1 Sep 2023 15:28:56 -0500 Subject: [PATCH 06/10] Add `external` label to external issues --- .github/workflows/label-external-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label-external-issues.yml b/.github/workflows/label-external-issues.yml index d08ff5267e..4c72ab8397 100644 --- a/.github/workflows/label-external-issues.yml +++ b/.github/workflows/label-external-issues.yml @@ -32,7 +32,7 @@ jobs: - name: add-triage-label run: | issue_url=${{ github.event.issue.html_url }} - gh issue edit ${issue_url} --add-label "Needs Triage" + gh issue edit ${issue_url} --add-label "Needs Triage,external" - name: add-comment-to-issue run: | From 4414df2d1f347df6087306b96e6b44cb4ad4af59 Mon Sep 17 00:00:00 2001 From: Ben Jarmak Date: Fri, 1 Sep 2023 16:16:38 -0500 Subject: [PATCH 07/10] [skip ci] Auto track dates for PRs --- .../project_automation_track_pr_dates.yml | 171 ++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 .github/workflows/project_automation_track_pr_dates.yml diff --git a/.github/workflows/project_automation_track_pr_dates.yml b/.github/workflows/project_automation_track_pr_dates.yml new file mode 100644 index 0000000000..c3ab939439 --- /dev/null +++ b/.github/workflows/project_automation_track_pr_dates.yml @@ -0,0 +1,171 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Set Dates + +on: + pull_request_target: + # Run this action when a PR is opened, ready for review, or closed + types: [opened, closed, ready_for_review] + +env: + ORG: ${{ github.event.repository.owner.login }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.event.repository.name }} + GH_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_PAT }} + OPENED_DATE: ${{ github.event.pull_request.created_at }} + CLOSED_DATE: ${{ github.event.pull_request.closed_at }} + TRIGGER: ${{ github.event.action }} + + # The environment vars below are hard-coded from external queries to save time + complexity here + # Note: PVT means Project V2, not "Private" - although this is a private project + # PVT = Project V2, PVTSSF = Project V2 Single Select Field, PVTIF = Project V2 Iteration Field, PVTF = Project V2 Date or Text Field + PROJECT_ID: "PVT_kwDOBkAsks4ACeio" + START_DATE_FIELD_ID: "PVTF_lADOBkAsks4ACeiozgLiId4" + REVIEW_START_DATE_FIELD_ID: "PVTF_lADOBkAsks4ACeiozgNUjEs" + END_DATE_FIELD_ID: "PVTF_lADOBkAsks4ACeiozgLiIf4" + +jobs: + set_pr_date_fields: + runs-on: ubuntu-latest + + steps: + - name: Sleep 1s + id: sleep_1s + run: sleep 1 + + - name: Get PR Project ID + id: get_pr_id + run: | + # Query up to 10 projects for the PR + gh api graphql -f query=' + query { + organization(login: "${{ env.ORG }}") { + repository(name: "${{ env.REPO }}") { + issueOrPullRequest(number: ${{ env.PR_NUMBER }}) { + ... on PullRequest { + id + projectItems(first: 10) { + edges { + node { + id + project { + id + } + } + } + } + } + } + } + } + }' > project_data.json + + # Filter the json result to only the project-specific ID for the PR + # A PR can be in multiple projects so we need to filter by the project ID we want + pr_id=$(jq -r '.data.organization.repository.issueOrPullRequest.projectItems.edges[] | + select(.node.project.id == "${{ env.PROJECT_ID }}") | + .node.id' project_data.json) + echo "PR_PROJECT_ID=$pr_id" >> $GITHUB_ENV + continue-on-error: true + + - name: Get Date for Review Start + if: ${{ env.TRIGGER == 'ready_for_review' }} || (${{ env.TRIGGER == 'opened' }} && ${{ github.event.pull_request.draft == false }}) + id: get_date + run: | + # Get the current date in the format required by ProjectsV2 GraphQL + # Uses EST timezone + # There's no github.action.date so we have to make one for the Review Date + # Otherwise we use the opened date or closed date + # If the PR is opened as a draft we will set both the open date and the review date as the same date + # An improvement could be to use the first commit date as the start date + + review_date=$(TZ=America/New_York date +"%Y-%m-%dT%H:%M:%SZ") + echo "REVIEW_DATE=$review_date" >> $GITHUB_ENV + + - name: Set PR Opened Date + id: set_open_date + if: ${{ env.TRIGGER == 'opened' }} + run: | + # Mutation to update the PRs's Opened Date field + echo "${{ env.OPENED_DATE }}" + gh api graphql -f query=' + mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: "${{ env.PROJECT_ID }}" + itemId: "${{ env.PR_PROJECT_ID }}" + fieldId: "${{ env.START_DATE_FIELD_ID }}" + value: { + date: "${{ env.OPENED_DATE }}" + } + } + ) { + projectV2Item { + id + } + } + }' + echo "PR Opened Date set to ${{ env.OPENED_DATE }}" + continue-on-error: true + + - name: Set PR Review Start Date + id: set_review_date + if: ${{ env.TRIGGER == 'ready_for_review' }} + run: | + # Mutation to update the PR's Review Start Date field + gh api graphql -f query=' + mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: "${{ env.PROJECT_ID }}" + itemId: "${{ env.PR_PROJECT_ID }}" + fieldId: "${{ env.REVIEW_START_DATE_FIELD_ID }}" + value: { + date: "${{ env.REVIEW_DATE }}" + } + } + ) { + projectV2Item { + id + } + } + }' + echo "PR Review Start Date set to ${{ env.REVIEW_DATE }}" + + - name: Set PR Closed Date + id: set_closed_date + if: ${{ env.TRIGGER == 'closed' }} + run: | + # Mutation to update the PR's Closed Date field + gh api graphql -f query=' + mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: "${{ env.PROJECT_ID }}" + itemId: "${{ env.PR_PROJECT_ID }}" + fieldId: "${{ env.END_DATE_FIELD_ID }}" + value: { + date: "${{ env.CLOSED_DATE }}" + } + } + ) { + projectV2Item { + id + } + } + }' + echo "PR Closed Date set to ${{ env.CLOSED_DATE }}" + continue-on-error: true From a37cc6d021d6d35017401a6bd5c02d5afc2b7861 Mon Sep 17 00:00:00 2001 From: Ben Jarmak Date: Wed, 6 Sep 2023 16:04:36 -0500 Subject: [PATCH 08/10] [skip ci] Apply fixes found in CCCL --- .github/workflows/project_automation_set_in_progress.yml | 2 +- .github/workflows/project_automation_sync_pr_issues.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/project_automation_set_in_progress.yml b/.github/workflows/project_automation_set_in_progress.yml index 39edbeb8c6..02c8957758 100644 --- a/.github/workflows/project_automation_set_in_progress.yml +++ b/.github/workflows/project_automation_set_in_progress.yml @@ -61,7 +61,7 @@ jobs: # If it is requesting changes, set PR to draft # We use the default token here since we're granting write access to the PR - elif [ ${{ github.event.pull_request.draft }} == true ]; then + elif [ ${{ github.event.pull_request.draft }} == false ]; then gh api graphql -f query=' mutation { convertPullRequestToDraft(input: {pullRequestId: "${{ env.PR_GLOBAL_ID }}"}) { diff --git a/.github/workflows/project_automation_sync_pr_issues.yml b/.github/workflows/project_automation_sync_pr_issues.yml index a0ecfd96ed..bc57fc3f54 100644 --- a/.github/workflows/project_automation_sync_pr_issues.yml +++ b/.github/workflows/project_automation_sync_pr_issues.yml @@ -98,7 +98,7 @@ jobs: } } }' > status_field_data.json - status_option_id=$(jq -r '.data.node.fieldValueByName.id' project_data.json) + status_option_id=$(jq -r '.data.node.fieldValueByName.id' status_field_data.json) echo "STATUS_OPTION_ID=$status_option_id" >> $GITHUB_ENV # Query the PR's start sprint from the project From 5de308aeb22b67aa805fb9a54be264ac76db2b6d Mon Sep 17 00:00:00 2001 From: Ben Jarmak Date: Fri, 8 Sep 2023 10:15:38 -0500 Subject: [PATCH 09/10] [skip ci] + logic to only set review date if null --- .../project_automation_track_pr_dates.yml | 56 +++++++++++++------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/.github/workflows/project_automation_track_pr_dates.yml b/.github/workflows/project_automation_track_pr_dates.yml index c3ab939439..5b3bac6575 100644 --- a/.github/workflows/project_automation_track_pr_dates.yml +++ b/.github/workflows/project_automation_track_pr_dates.yml @@ -94,6 +94,7 @@ jobs: review_date=$(TZ=America/New_York date +"%Y-%m-%dT%H:%M:%SZ") echo "REVIEW_DATE=$review_date" >> $GITHUB_ENV + continue-on-error: true - name: Set PR Opened Date id: set_open_date @@ -123,27 +124,46 @@ jobs: - name: Set PR Review Start Date id: set_review_date - if: ${{ env.TRIGGER == 'ready_for_review' }} - run: | - # Mutation to update the PR's Review Start Date field + if: ${{ env.TRIGGER == 'ready_for_review' }} || (${{ env.TRIGGER == 'opened' }} && ${{ github.event.pull_request.draft == false }}) + run: | + # Check the Review Start Date gh api graphql -f query=' - mutation { - updateProjectV2ItemFieldValue( - input: { - projectId: "${{ env.PROJECT_ID }}" - itemId: "${{ env.PR_PROJECT_ID }}" - fieldId: "${{ env.REVIEW_START_DATE_FIELD_ID }}" - value: { - date: "${{ env.REVIEW_DATE }}" - } - } - ) { - projectV2Item { - id + query { + node(id: "${{ env.PR_PROJECT_ID }}") { + ... on ProjectV2Item { + fieldValueByName(name: "Review Start Date") { + ... on ProjectV2ItemFieldDateValue { + date } + } } - }' - echo "PR Review Start Date set to ${{ env.REVIEW_DATE }}" + } + }' > pr_date_data.json + date=$(jq -r '.data.node.fieldValueByName' pr_date_data.json) + + # If the Review Start Date is not set, set it + if [ "$date" == "null" ]; then + # Mutation to update the PR's Review Start Date field + gh api graphql -f query=' + mutation { + updateProjectV2ItemFieldValue( + input: { + projectId: "${{ env.PROJECT_ID }}" + itemId: "${{ env.PR_PROJECT_ID }}" + fieldId: "${{ env.REVIEW_START_DATE_FIELD_ID }}" + value: { + date: "${{ env.REVIEW_DATE }}" + } + } + ) { + projectV2Item { + id + } + } + }' + echo "PR Review Start Date set to ${{ env.REVIEW_DATE }}" + fi + continue-on-error: true - name: Set PR Closed Date id: set_closed_date From 65f54dc70537170afa380be1f131e73d910489f1 Mon Sep 17 00:00:00 2001 From: Ben Jarmak Date: Fri, 8 Sep 2023 10:25:32 -0500 Subject: [PATCH 10/10] [skip ci] Apply changes from review --- .github/PULL_REQUEST_TEMPLATE.md | 13 +++++++------ .../project_automation_set_in_progress.yml | 2 +- .../workflows/project_automation_set_in_review.yml | 2 +- .../workflows/project_automation_set_roadmap.yml | 2 +- .../workflows/project_automation_sync_pr_issues.yml | 2 +- .../workflows/project_automation_track_pr_dates.yml | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 539f7f686e..47d7df71ca 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,9 +1,10 @@ ## Description - - + + +Closes -## Checklist -- [ ] I am familiar with the [Contributing Guidelines](https://github.com/nv-morpheus/Morpheus/blob/main/docs/source/developer_guide/contributing.md). -- [ ] New or existing tests cover these changes. -- [ ] The documentation is up to date with these changes. +## By Submitting this PR I confirm: +- I am familiar with the [Contributing Guidelines](https://github.com/nv-morpheus/Morpheus/blob/main/docs/source/developer_guide/contributing.md). +- When the PR is ready for review, new or existing tests cover these changes. +- When the PR is ready for review, the documentation is up to date with these changes. diff --git a/.github/workflows/project_automation_set_in_progress.yml b/.github/workflows/project_automation_set_in_progress.yml index 02c8957758..c6f53d3bf6 100644 --- a/.github/workflows/project_automation_set_in_progress.yml +++ b/.github/workflows/project_automation_set_in_progress.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Set PR and Linked Issues to In Progress +name: Project - Set PR and Linked Issues to In Progress on: pull_request_target: diff --git a/.github/workflows/project_automation_set_in_review.yml b/.github/workflows/project_automation_set_in_review.yml index a02c93400b..c6153bfe6b 100644 --- a/.github/workflows/project_automation_set_in_review.yml +++ b/.github/workflows/project_automation_set_in_review.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Set PR and Linked Issues to In Review +name: Project - Set PR and Linked Issues to In Review on: pull_request_target: diff --git a/.github/workflows/project_automation_set_roadmap.yml b/.github/workflows/project_automation_set_roadmap.yml index b41a636d15..147ea3c4c2 100644 --- a/.github/workflows/project_automation_set_roadmap.yml +++ b/.github/workflows/project_automation_set_roadmap.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Set PR or Issue Roadmap Value on Close +name: Project - Set PR or Issue Roadmap Value on Close on: pull_request_target: diff --git a/.github/workflows/project_automation_sync_pr_issues.yml b/.github/workflows/project_automation_sync_pr_issues.yml index bc57fc3f54..11e4f5c8ee 100644 --- a/.github/workflows/project_automation_sync_pr_issues.yml +++ b/.github/workflows/project_automation_sync_pr_issues.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Synchronize Linked Issues +name: Project - Synchronize Linked Issues on: pull_request_target: diff --git a/.github/workflows/project_automation_track_pr_dates.yml b/.github/workflows/project_automation_track_pr_dates.yml index 5b3bac6575..0d6b807dd1 100644 --- a/.github/workflows/project_automation_track_pr_dates.yml +++ b/.github/workflows/project_automation_track_pr_dates.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Set Dates +name: Project - Set PR Dates on: pull_request_target: