Skip to content

Commit

Permalink
fix: change order of edge case resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Balvajs committed Oct 5, 2023
1 parent 358949f commit 67af27f
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 4 deletions.
32 changes: 31 additions & 1 deletion dist/main.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main.cjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/get-inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getInput, getMultilineInput } from '@actions/core'

function isValidDismissActionInput(
dismissAction: string,
): dismissAction is 'dismissAction' | 'dismiss-none' {
): dismissAction is 'dismiss-all' | 'dismiss-none' {
return dismissAction === 'dismiss-all' || dismissAction === 'dismiss-none'
}

Expand Down
39 changes: 38 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,45 @@ const run = async () => {
.join()}`,
)

// if there are some files without history let the users know and dismiss reviews calculated for dismiss
if (reviewsToDismissContext.reviewsWithoutHistory?.length) {
console.log(
chalk.yellow(
`Files diff can't be resolved for following reviews due to force push:\n${reviewsToDismissContext.reviewsWithoutHistory
.map(({ author }) => author?.login)
.join('\n')}\n`,
),
)

if (forcePushAction === 'dismiss-none') {
console.log(
chalk.yellow(
'"force-push-action" is set to "dismiss-none", so no reviews are dismissed.',
),
)

return
}

await dismissReviews({
octokit,
reviewsToDismiss: reviewsToDismissContext.reviewsToDismiss,
message: `
<details>
<summary>Following reviews were removed because related commit was overwritten by force push.</summary>
<p>
- \`${reviewsToDismissContext.reviewsWithoutHistory
.map(({ author }) => author?.login)
.join('`\n- `')}\`
</p>
</details>
`.replace(/ +/g, ' '),
})
}
// if there are any files without owner, dismiss all reviews
if (reviewsToDismissContext.filesWithoutOwner) {
else if (reviewsToDismissContext.filesWithoutOwner) {
console.log(
chalk.yellow(
'Files without owner:\n',
Expand Down

0 comments on commit 67af27f

Please sign in to comment.