From b3bf82ea60ea2826869f0a7d4209bb4fbe275ff4 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Wed, 10 Jun 2026 10:57:16 -0700 Subject: [PATCH 1/7] Introduces workflow to make PR ready to review again with addressed feedback --- .../remove-author-attention-label.yml | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/remove-author-attention-label.yml diff --git a/.github/workflows/remove-author-attention-label.yml b/.github/workflows/remove-author-attention-label.yml new file mode 100644 index 0000000000..b38bc24c7e --- /dev/null +++ b/.github/workflows/remove-author-attention-label.yml @@ -0,0 +1,74 @@ +name: Remove Author Attention Needed Label + +on: + issue_comment: + types: [created] + +jobs: + remove-label: + # Only run on PR comments with '/ready' from the PR author + if: >- + github.repository == 'dotnet/SqlClient' && + github.event.issue.pull_request != null && + github.event.comment.user.login == github.event.issue.user.login && + contains(github.event.comment.body, '/ready') + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Remove 'Author Attention Needed' label + uses: actions/github-script@v9 + with: + script: | + const labelName = 'Author Attention Needed'; + const issue_number = context.issue.number; + const owner = context.repo.owner; + const repo = context.repo.repo; + + // Check if the label exists on the PR + const labels = await github.rest.issues.listLabelsOnIssue({ + owner, + repo, + issue_number, + }); + + const hasLabel = labels.data.some(label => label.name === labelName); + + if (hasLabel) { + await github.rest.issues.removeLabel({ + owner, + repo, + issue_number, + name: labelName, + }); + core.info(`Removed '${labelName}' label from PR #${issue_number}`); + } else { + core.info(`PR #${issue_number} does not have the '${labelName}' label. No action taken.`); + } + + // Re-request reviews from existing reviewers + const reviews = await github.rest.pulls.listReviews({ + owner, + repo, + pull_number: issue_number, + }); + + // Collect unique reviewers (exclude the PR author) + const author = context.payload.issue.user.login; + const reviewers = [...new Set( + reviews.data + .map(r => r.user.login) + .filter(login => login !== author) + )]; + + if (reviewers.length > 0) { + await github.rest.pulls.requestReviewers({ + owner, + repo, + pull_number: issue_number, + reviewers, + }); + core.info(`Re-requested reviews from: ${reviewers.join(', ')}`); + } else { + core.info('No previous reviewers to re-request.'); + } From e2222e4b5f0fbff3ea957162688971b5c9192058 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Date: Wed, 10 Jun 2026 11:09:24 -0700 Subject: [PATCH 2/7] Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/remove-author-attention-label.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/remove-author-attention-label.yml b/.github/workflows/remove-author-attention-label.yml index b38bc24c7e..a87e7886df 100644 --- a/.github/workflows/remove-author-attention-label.yml +++ b/.github/workflows/remove-author-attention-label.yml @@ -14,6 +14,7 @@ jobs: contains(github.event.comment.body, '/ready') runs-on: ubuntu-latest permissions: + issues: write pull-requests: write steps: - name: Remove 'Author Attention Needed' label @@ -46,19 +47,20 @@ jobs: core.info(`PR #${issue_number} does not have the '${labelName}' label. No action taken.`); } - // Re-request reviews from existing reviewers - const reviews = await github.rest.pulls.listReviews({ + // Re-request reviews from existing reviewers (paginate to include all reviews) + const reviews = await github.paginate(github.rest.pulls.listReviews, { owner, repo, pull_number: issue_number, + per_page: 100, }); // Collect unique reviewers (exclude the PR author) const author = context.payload.issue.user.login; const reviewers = [...new Set( - reviews.data - .map(r => r.user.login) - .filter(login => login !== author) + reviews + .map(r => r.user?.login) + .filter(login => login && login !== author) )]; if (reviewers.length > 0) { From 482195a9847707e205bce13eb875f6169b44c10f Mon Sep 17 00:00:00 2001 From: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Date: Wed, 10 Jun 2026 11:31:33 -0700 Subject: [PATCH 3/7] Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/remove-author-attention-label.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/remove-author-attention-label.yml b/.github/workflows/remove-author-attention-label.yml index a87e7886df..49734908d9 100644 --- a/.github/workflows/remove-author-attention-label.yml +++ b/.github/workflows/remove-author-attention-label.yml @@ -27,13 +27,14 @@ jobs: const repo = context.repo.repo; // Check if the label exists on the PR - const labels = await github.rest.issues.listLabelsOnIssue({ + const labels = await github.paginate(github.rest.issues.listLabelsOnIssue, { owner, repo, issue_number, + per_page: 100, }); - const hasLabel = labels.data.some(label => label.name === labelName); + const hasLabel = labels.some(label => label.name === labelName); if (hasLabel) { await github.rest.issues.removeLabel({ @@ -59,6 +60,7 @@ jobs: const author = context.payload.issue.user.login; const reviewers = [...new Set( reviews + .filter(r => r.user?.type === 'User') .map(r => r.user?.login) .filter(login => login && login !== author) )]; From 1182a841c44db0a983f766737e468bebc703aa7b Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Wed, 10 Jun 2026 18:15:49 -0700 Subject: [PATCH 4/7] include label comment --- .github/workflows/notify-author-attention.yml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/notify-author-attention.yml diff --git a/.github/workflows/notify-author-attention.yml b/.github/workflows/notify-author-attention.yml new file mode 100644 index 0000000000..ca8adb20ca --- /dev/null +++ b/.github/workflows/notify-author-attention.yml @@ -0,0 +1,34 @@ +name: Notify Author Attention Needed + +on: + pull_request_target: + types: [labeled] + +jobs: + notify-author: + # Only run when 'Author Attention Needed' label is added to a PR + if: >- + github.repository == 'dotnet/SqlClient' && + github.event.label.name == 'Author Attention Needed' + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Post comment to PR author + uses: actions/github-script@v9 + with: + script: | + const issue_number = context.payload.pull_request.number; + const owner = context.repo.owner; + const repo = context.repo.repo; + const author = context.payload.pull_request.user.login; + + const body = `@${author} This pull request has been marked as **Author Attention Needed**.\n\nWhen you have addressed the reviewer feedback and are ready for another review, please post a comment with \`/ready\` to remove the label and re-engage reviewers.`; + + await github.rest.issues.createComment({ + owner, + repo, + issue_number, + body, + }); + core.info(`Posted notification comment on PR #${issue_number}`); From a606801a975cf26c571fd1a8cb3439666c1c82c3 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Wed, 10 Jun 2026 22:55:02 -0700 Subject: [PATCH 5/7] Update label --- .github/workflows/notify-author-attention.yml | 8 ++++---- .github/workflows/remove-author-attention-label.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/notify-author-attention.yml b/.github/workflows/notify-author-attention.yml index ca8adb20ca..b5b49ed204 100644 --- a/.github/workflows/notify-author-attention.yml +++ b/.github/workflows/notify-author-attention.yml @@ -1,4 +1,4 @@ -name: Notify Author Attention Needed +name: Notify Author attention needed on: pull_request_target: @@ -6,10 +6,10 @@ on: jobs: notify-author: - # Only run when 'Author Attention Needed' label is added to a PR + # Only run when 'Author attention needed' label is added to a PR if: >- github.repository == 'dotnet/SqlClient' && - github.event.label.name == 'Author Attention Needed' + github.event.label.name == 'Author attention needed' runs-on: ubuntu-latest permissions: pull-requests: write @@ -23,7 +23,7 @@ jobs: const repo = context.repo.repo; const author = context.payload.pull_request.user.login; - const body = `@${author} This pull request has been marked as **Author Attention Needed**.\n\nWhen you have addressed the reviewer feedback and are ready for another review, please post a comment with \`/ready\` to remove the label and re-engage reviewers.`; + const body = `@${author} This pull request has been marked as **Author attention needed**.\n\nWhen you have addressed the reviewer feedback and are ready for another review, please post a comment with \`/ready\` to remove the label and re-engage reviewers.`; await github.rest.issues.createComment({ owner, diff --git a/.github/workflows/remove-author-attention-label.yml b/.github/workflows/remove-author-attention-label.yml index 49734908d9..43af0ed951 100644 --- a/.github/workflows/remove-author-attention-label.yml +++ b/.github/workflows/remove-author-attention-label.yml @@ -1,4 +1,4 @@ -name: Remove Author Attention Needed Label +name: Remove Author attention needed Label on: issue_comment: @@ -17,11 +17,11 @@ jobs: issues: write pull-requests: write steps: - - name: Remove 'Author Attention Needed' label + - name: Remove 'Author attention needed' label uses: actions/github-script@v9 with: script: | - const labelName = 'Author Attention Needed'; + const labelName = 'Author attention needed'; const issue_number = context.issue.number; const owner = context.repo.owner; const repo = context.repo.repo; From 2148aa185dbd13fd93c728251182798afe88c395 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Date: Wed, 10 Jun 2026 22:59:34 -0700 Subject: [PATCH 6/7] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../remove-author-attention-label.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/remove-author-attention-label.yml b/.github/workflows/remove-author-attention-label.yml index 43af0ed951..4caf4067ca 100644 --- a/.github/workflows/remove-author-attention-label.yml +++ b/.github/workflows/remove-author-attention-label.yml @@ -36,18 +36,19 @@ jobs: const hasLabel = labels.some(label => label.name === labelName); - if (hasLabel) { - await github.rest.issues.removeLabel({ - owner, - repo, - issue_number, - name: labelName, - }); - core.info(`Removed '${labelName}' label from PR #${issue_number}`); - } else { + if (!hasLabel) { core.info(`PR #${issue_number} does not have the '${labelName}' label. No action taken.`); + return; } + await github.rest.issues.removeLabel({ + owner, + repo, + issue_number, + name: labelName, + }); + core.info(`Removed '${labelName}' label from PR #${issue_number}`); + // Re-request reviews from existing reviewers (paginate to include all reviews) const reviews = await github.paginate(github.rest.pulls.listReviews, { owner, From b5606a5b130917ffbfb4150e6e390fe58432d6b4 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Wed, 10 Jun 2026 23:15:43 -0700 Subject: [PATCH 7/7] updates --- .github/workflows/notify-author-attention.yml | 1 + .../remove-author-attention-label.yml | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/notify-author-attention.yml b/.github/workflows/notify-author-attention.yml index b5b49ed204..4799e9efd1 100644 --- a/.github/workflows/notify-author-attention.yml +++ b/.github/workflows/notify-author-attention.yml @@ -12,6 +12,7 @@ jobs: github.event.label.name == 'Author attention needed' runs-on: ubuntu-latest permissions: + issues: write pull-requests: write steps: - name: Post comment to PR author diff --git a/.github/workflows/remove-author-attention-label.yml b/.github/workflows/remove-author-attention-label.yml index 4caf4067ca..808de9b9c2 100644 --- a/.github/workflows/remove-author-attention-label.yml +++ b/.github/workflows/remove-author-attention-label.yml @@ -11,7 +11,7 @@ jobs: github.repository == 'dotnet/SqlClient' && github.event.issue.pull_request != null && github.event.comment.user.login == github.event.issue.user.login && - contains(github.event.comment.body, '/ready') + startsWith(github.event.comment.body, '/ready') runs-on: ubuntu-latest permissions: issues: write @@ -67,13 +67,17 @@ jobs: )]; if (reviewers.length > 0) { - await github.rest.pulls.requestReviewers({ - owner, - repo, - pull_number: issue_number, - reviewers, - }); - core.info(`Re-requested reviews from: ${reviewers.join(', ')}`); + try { + await github.rest.pulls.requestReviewers({ + owner, + repo, + pull_number: issue_number, + reviewers: reviewers.slice(0, 15), + }); + core.info(`Re-requested reviews from: ${reviewers.join(', ')}`); + } catch (err) { + core.warning(`Failed to re-request reviewers: ${err.message}`); + } } else { core.info('No previous reviewers to re-request.'); }