Loading ci/github-script/reviews.js +23 −3 Original line number Diff line number Diff line const eventToState = { COMMENT: 'COMMENTED', REQUEST_CHANGES: 'CHANGES_REQUESTED', } /** * @param {{ * github: InstanceType<import('@actions/github/lib/utils').GitHub>, * context: import('@actions/github/lib/context').Context * core: import('@actions/core') * dry: boolean * }} CheckTargetBranchProps */ async function dismissReviews({ github, context, dry }) { const pull_number = context.payload.pull_request.number Loading Loading @@ -36,7 +49,14 @@ async function dismissReviews({ github, context, dry }) { ) } async function postReview({ github, context, core, dry, body }) { async function postReview({ github, context, core, dry, body, event = 'REQUEST_CHANGES', }) { const pull_number = context.payload.pull_request.number const pendingReview = ( Loading @@ -49,7 +69,7 @@ async function postReview({ github, context, core, dry, body }) { 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', review.state === eventToState[event], ) if (dry) { Loading @@ -69,7 +89,7 @@ async function postReview({ github, context, core, dry, body }) { await github.rest.pulls.createReview({ ...context.repo, pull_number, event: 'REQUEST_CHANGES', event, body, }) } Loading Loading
ci/github-script/reviews.js +23 −3 Original line number Diff line number Diff line const eventToState = { COMMENT: 'COMMENTED', REQUEST_CHANGES: 'CHANGES_REQUESTED', } /** * @param {{ * github: InstanceType<import('@actions/github/lib/utils').GitHub>, * context: import('@actions/github/lib/context').Context * core: import('@actions/core') * dry: boolean * }} CheckTargetBranchProps */ async function dismissReviews({ github, context, dry }) { const pull_number = context.payload.pull_request.number Loading Loading @@ -36,7 +49,14 @@ async function dismissReviews({ github, context, dry }) { ) } async function postReview({ github, context, core, dry, body }) { async function postReview({ github, context, core, dry, body, event = 'REQUEST_CHANGES', }) { const pull_number = context.payload.pull_request.number const pendingReview = ( Loading @@ -49,7 +69,7 @@ async function postReview({ github, context, core, dry, body }) { 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', review.state === eventToState[event], ) if (dry) { Loading @@ -69,7 +89,7 @@ async function postReview({ github, context, core, dry, body }) { await github.rest.pulls.createReview({ ...context.repo, pull_number, event: 'REQUEST_CHANGES', event, body, }) } Loading