From d33ba69905f310b791b6731d0a5ce1476de0bc86 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Fri, 14 Apr 2023 11:10:02 -0400 Subject: [PATCH 1/4] issue-pr act on closing and review submission Act on issue and PR close action and move to Done Act on review submission and move to PRs approved --- .github/workflows/call-issue-pr-tracker.yml | 6 ++-- .github/workflows/issue-pr-tracker.yml | 31 +++++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/call-issue-pr-tracker.yml b/.github/workflows/call-issue-pr-tracker.yml index 87243e2..2c30784 100644 --- a/.github/workflows/call-issue-pr-tracker.yml +++ b/.github/workflows/call-issue-pr-tracker.yml @@ -2,9 +2,11 @@ name: Issue & PR Tracker on: issues: - types: [opened,reopened,labeled,unlabeled] + types: [opened,reopened,labeled,unlabeled,closed] pull_request_target: - types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled] + types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled,closed] + pull_request_review: + types: [submitted,edited,dismissed] jobs: manage-project: diff --git a/.github/workflows/issue-pr-tracker.yml b/.github/workflows/issue-pr-tracker.yml index 7ea5262..5f0b81f 100644 --- a/.github/workflows/issue-pr-tracker.yml +++ b/.github/workflows/issue-pr-tracker.yml @@ -36,9 +36,27 @@ jobs: project_id: 8 resource_node_id: ${{ github.event.issue.node_id }} status_value: 'Insufficient Info' + - name: Move Closed Issues to Done + uses: leonsteinhaeuser/project-beta-automations@v2.1.0 + if: ${{ github.event.issue.state == 'closed' }} + with: + gh_token: ${{ secrets.CR_PAT }} + organization: linuxserver + project_id: 8 + resource_node_id: ${{ github.event.issue.node_id }} + status_value: 'Done' + - name: Move Closed PRs to Done + uses: leonsteinhaeuser/project-beta-automations@v2.1.0 + if: ${{ github.event.pull_request.state == 'closed' }} + with: + gh_token: ${{ secrets.CR_PAT }} + organization: linuxserver + project_id: 8 + resource_node_id: ${{ github.event.pull_request.node_id }} + status_value: 'Done' - name: Add Open PRs Without Review Requests uses: leonsteinhaeuser/project-beta-automations@v2.1.0 - if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.state == 'open' && github.event.pull_request.requested_reviewers[0] == null && github.event.pull_request.requested_teams[0] == null }} + if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && github.event.pull_request.requested_reviewers[0] == null && github.event.pull_request.requested_teams[0] == null && github.event.review.state != 'approved' }} with: gh_token: ${{ secrets.CR_PAT }} organization: linuxserver @@ -47,7 +65,16 @@ jobs: status_value: 'PRs' - name: Add Open PRs With Review Requests uses: leonsteinhaeuser/project-beta-automations@v2.1.0 - if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.state == 'open' && (github.event.pull_request.requested_reviewers[0] != null || github.event.pull_request.requested_teams[0] != null) }} + if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && (github.event.pull_request.requested_reviewers[0] != null || github.event.pull_request.requested_teams[0] != null) && github.event.review.state != 'approved' }} + with: + gh_token: ${{ secrets.CR_PAT }} + organization: linuxserver + project_id: 8 + resource_node_id: ${{ github.event.pull_request.node_id }} + status_value: 'PRs Ready For Team Review' + - name: Move Approved PRs + uses: leonsteinhaeuser/project-beta-automations@v2.1.0 + if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && github.event.review.state == 'approved' }} with: gh_token: ${{ secrets.CR_PAT }} organization: linuxserver From ffd2b5107ea153b7a9d8a755a12a4a1604ad8d89 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Fri, 14 Apr 2023 11:29:01 -0400 Subject: [PATCH 2/4] combine steps --- .github/workflows/issue-pr-tracker.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/issue-pr-tracker.yml b/.github/workflows/issue-pr-tracker.yml index 5f0b81f..639de49 100644 --- a/.github/workflows/issue-pr-tracker.yml +++ b/.github/workflows/issue-pr-tracker.yml @@ -36,23 +36,14 @@ jobs: project_id: 8 resource_node_id: ${{ github.event.issue.node_id }} status_value: 'Insufficient Info' - - name: Move Closed Issues to Done + - name: Move Closed Issues and PRs to Done uses: leonsteinhaeuser/project-beta-automations@v2.1.0 - if: ${{ github.event.issue.state == 'closed' }} + if: ${{ github.event.issue.state == 'closed' || github.event.pull_request.state == 'closed' }} with: gh_token: ${{ secrets.CR_PAT }} organization: linuxserver project_id: 8 - resource_node_id: ${{ github.event.issue.node_id }} - status_value: 'Done' - - name: Move Closed PRs to Done - uses: leonsteinhaeuser/project-beta-automations@v2.1.0 - if: ${{ github.event.pull_request.state == 'closed' }} - with: - gh_token: ${{ secrets.CR_PAT }} - organization: linuxserver - project_id: 8 - resource_node_id: ${{ github.event.pull_request.node_id }} + resource_node_id: ${{ github.event.issue.node_id || github.event.pull_request.node_id }} status_value: 'Done' - name: Add Open PRs Without Review Requests uses: leonsteinhaeuser/project-beta-automations@v2.1.0 From c05347fd6f67948856b5be58b8a7f6ba306c43b7 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Fri, 14 Apr 2023 12:49:05 -0400 Subject: [PATCH 3/4] Add summary comments, fix typo in approved PR action --- .github/workflows/issue-pr-tracker.yml | 34 +++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/issue-pr-tracker.yml b/.github/workflows/issue-pr-tracker.yml index 639de49..8a23083 100644 --- a/.github/workflows/issue-pr-tracker.yml +++ b/.github/workflows/issue-pr-tracker.yml @@ -18,6 +18,10 @@ jobs: project_id: 8 resource_node_id: ${{ github.event.issue.node_id }} status_value: 'Issues' + - name: Add Open Docker Related Issues Not Labeled Invalid (summary comment) + if: ${{ github.event_name == 'issues' && github.event.issue.state == 'open' && startsWith(github.event.repository.name, 'docker-') && ! contains(github.event.issue.labels.*.name, 'invalid') }} + run: | + echo 'Issue [#${{ github.event.issue.number }}](${{ github.event.issue.html_url }}) is added to [project] column "Issues"' >> $GITHUB_STEP_SUMMARY - name: Add Open Non-Docker Related Issues Not Labeled Invalid uses: leonsteinhaeuser/project-beta-automations@v2.1.0 if: ${{ github.event_name == 'issues' && github.event.issue.state == 'open' && ! startsWith(github.event.repository.name, 'docker-') && ! contains(github.event.issue.labels.*.name, 'invalid') }} @@ -27,6 +31,10 @@ jobs: project_id: 8 resource_node_id: ${{ github.event.issue.node_id }} status_value: 'Non-Docker Issues' + - name: Add Open Non-Docker Related Issues Not Labeled Invalid (summary comment) + if: ${{ github.event_name == 'issues' && github.event.issue.state == 'open' && ! startsWith(github.event.repository.name, 'docker-') && ! contains(github.event.issue.labels.*.name, 'invalid') }} + run: | + echo 'Issue [#${{ github.event.issue.number }}](${{ github.event.issue.html_url }}) is added to [project] column "Non-Docker Issues"' >> $GITHUB_STEP_SUMMARY - name: Add Open Issues Labeled Invalid uses: leonsteinhaeuser/project-beta-automations@v2.1.0 if: ${{ github.event_name == 'issues' && github.event.issue.state == 'open' && contains(github.event.issue.labels.*.name, 'invalid') }} @@ -36,6 +44,10 @@ jobs: project_id: 8 resource_node_id: ${{ github.event.issue.node_id }} status_value: 'Insufficient Info' + - name: Add Open Issues Labeled Invalid (summary comment) + if: ${{ github.event_name == 'issues' && github.event.issue.state == 'open' && contains(github.event.issue.labels.*.name, 'invalid') }} + run: | + echo 'Issue [#${{ github.event.issue.number }}](${{ github.event.issue.html_url }}) is added to [project] column "Insufficient Info"' >> $GITHUB_STEP_SUMMARY - name: Move Closed Issues and PRs to Done uses: leonsteinhaeuser/project-beta-automations@v2.1.0 if: ${{ github.event.issue.state == 'closed' || github.event.pull_request.state == 'closed' }} @@ -45,6 +57,10 @@ jobs: project_id: 8 resource_node_id: ${{ github.event.issue.node_id || github.event.pull_request.node_id }} status_value: 'Done' + - name: Move Closed Issues and PRs to Done (summary comment) + if: ${{ github.event.issue.state == 'closed' || github.event.pull_request.state == 'closed' }} + run: | + echo 'Issue or PR [#${{ github.event.issue.number || github.even.pull_request.number }}](${{ github.event.issue.html_url || github.event.pull_request.html_url }}) is added to [project] column "Done"' >> $GITHUB_STEP_SUMMARY - name: Add Open PRs Without Review Requests uses: leonsteinhaeuser/project-beta-automations@v2.1.0 if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && github.event.pull_request.requested_reviewers[0] == null && github.event.pull_request.requested_teams[0] == null && github.event.review.state != 'approved' }} @@ -54,6 +70,10 @@ jobs: project_id: 8 resource_node_id: ${{ github.event.pull_request.node_id }} status_value: 'PRs' + - name: Add Open PRs Without Review Requests (summary comment) + if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && github.event.pull_request.requested_reviewers[0] == null && github.event.pull_request.requested_teams[0] == null && github.event.review.state != 'approved' }} + run: | + echo 'PR [#${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }}) is added to [project] column "PRs"' >> $GITHUB_STEP_SUMMARY - name: Add Open PRs With Review Requests uses: leonsteinhaeuser/project-beta-automations@v2.1.0 if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && (github.event.pull_request.requested_reviewers[0] != null || github.event.pull_request.requested_teams[0] != null) && github.event.review.state != 'approved' }} @@ -63,6 +83,10 @@ jobs: project_id: 8 resource_node_id: ${{ github.event.pull_request.node_id }} status_value: 'PRs Ready For Team Review' + - name: Add Open PRs With Review Requests (summary comment) + if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && (github.event.pull_request.requested_reviewers[0] != null || github.event.pull_request.requested_teams[0] != null) && github.event.review.state != 'approved' }} + run: | + echo 'PR [#${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }}) is added to [project] column "PRs Ready For Team Review"' >> $GITHUB_STEP_SUMMARY - name: Move Approved PRs uses: leonsteinhaeuser/project-beta-automations@v2.1.0 if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && github.event.review.state == 'approved' }} @@ -71,7 +95,11 @@ jobs: organization: linuxserver project_id: 8 resource_node_id: ${{ github.event.pull_request.node_id }} - status_value: 'PRs Ready For Team Review' + status_value: 'PRs Approved' + - name: Move Approved PRs (summary comment) + if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && github.event.review.state == 'approved' }} + run: | + echo 'PR [#${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }}) is added to [project] column "PRs Approved"' >> $GITHUB_STEP_SUMMARY - name: Add Comment on Invalid Labeling uses: peter-evans/create-or-update-comment@v2.1.1 if: ${{ github.event_name == 'issues' && github.event.issue.state == 'open' && github.event.label.name == 'invalid' && contains(github.event.issue.labels.*.name, 'invalid') }} @@ -79,3 +107,7 @@ jobs: issue-number: ${{ github.event.issue.number}} body: | A human has marked this issue as invalid, this likely happened because the issue template was not used in the creation of the issue. + - name: Add Comment on Invalid Labeling (summary comment) + if: ${{ github.event_name == 'issues' && github.event.issue.state == 'open' && github.event.label.name == 'invalid' && contains(github.event.issue.labels.*.name, 'invalid') }} + run: | + echo 'Commented on issue [#${{ github.event.issue.number }}](${{ github.event.issue.html_url }}) that was marked invalid' >> $GITHUB_STEP_SUMMARY From 09192bc7eccfa73461e74b5d318c89eed82a425e Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Fri, 14 Apr 2023 12:50:51 -0400 Subject: [PATCH 4/4] silly typo --- .github/workflows/issue-pr-tracker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-pr-tracker.yml b/.github/workflows/issue-pr-tracker.yml index 8a23083..1a42923 100644 --- a/.github/workflows/issue-pr-tracker.yml +++ b/.github/workflows/issue-pr-tracker.yml @@ -60,7 +60,7 @@ jobs: - name: Move Closed Issues and PRs to Done (summary comment) if: ${{ github.event.issue.state == 'closed' || github.event.pull_request.state == 'closed' }} run: | - echo 'Issue or PR [#${{ github.event.issue.number || github.even.pull_request.number }}](${{ github.event.issue.html_url || github.event.pull_request.html_url }}) is added to [project] column "Done"' >> $GITHUB_STEP_SUMMARY + echo 'Issue or PR [#${{ github.event.issue.number || github.event.pull_request.number }}](${{ github.event.issue.html_url || github.event.pull_request.html_url }}) is added to [project] column "Done"' >> $GITHUB_STEP_SUMMARY - name: Add Open PRs Without Review Requests uses: leonsteinhaeuser/project-beta-automations@v2.1.0 if: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.state == 'open' && github.event.pull_request.requested_reviewers[0] == null && github.event.pull_request.requested_teams[0] == null && github.event.review.state != 'approved' }}