···
const { execFileSync } = require('node:child_process')
const { classify } = require('../supportedBranches.js')
const withRateLimit = require('./withRateLimit.js')
await withRateLimit({ github, core }, async (stats) => {
···
// An empty results array will always trigger this condition, which is helpful
// to clean up reviews created by the prepare step when on the wrong branch.
if (results.every(({ severity }) => severity === 'info')) {
-
await github.paginate(github.rest.pulls.listReviews, {
-
.filter((review) => review.user.login === 'github-actions[bot]')
-
.map(async (review) => {
-
if (review.state === 'CHANGES_REQUESTED') {
-
await github.rest.pulls.dismissReview({
-
message: 'All good now, thank you!',
-
`mutation($node_id:ID!) {
-
minimizeComment(input: {
-
{ node_id: review.node_id },
···
const body = core.summary.stringify()
-
const pendingReview = (
-
await github.paginate(github.rest.pulls.listReviews, {
-
review.user.login === 'github-actions[bot]' &&
-
// If a review is still pending, we can just update this instead
-
// of posting a new one.
-
(review.state === 'CHANGES_REQUESTED' ||
-
// No need to post a new review, if an older one with the exact
-
// same content had already been dismissed.
-
core.info(`pending review found: ${pendingReview.html_url}`)
-
else core.info('no pending review found')
-
// Either of those two requests could fail for very long comments. This can only happen
-
// with multiple commits all hitting the truncation limit for the diff. If you ever hit
-
// this case, consider just splitting up those commits into multiple PRs.
-
await github.rest.pulls.updateReview({
-
review_id: pendingReview.id,
-
await github.rest.pulls.createReview({
-
event: 'REQUEST_CHANGES',
···
const { execFileSync } = require('node:child_process')
const { classify } = require('../supportedBranches.js')
const withRateLimit = require('./withRateLimit.js')
+
const { dismissReviews, postReview } = require('./reviews.js')
await withRateLimit({ github, core }, async (stats) => {
···
// An empty results array will always trigger this condition, which is helpful
// to clean up reviews created by the prepare step when on the wrong branch.
if (results.every(({ severity }) => severity === 'info')) {
+
await dismissReviews({ github, context, dry })
···
const body = core.summary.stringify()
+
// Posting a review could fail for very long comments. This can only happen with
+
// multiple commits all hitting the truncation limit for the diff. If you ever hit
+
// this case, consider just splitting up those commits into multiple PRs.
+
await postReview({ github, context, core, dry, body })