Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update comment steps state on review events
- Loading branch information
1 parent
b03bd10
commit c94c102
Showing
5 changed files
with
90 additions
and
28 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/events/pr-handlers/actions/updateCommentBodyProgressFromStepsState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { EventsWithRepository } from 'context/repoContext'; | ||
import type { ProbotEvent } from '../../probot-types'; | ||
import type { ReviewflowPrContext } from '../utils/createPullRequestContext'; | ||
import { updatePrCommentBodyIfNeeded } from './updatePrCommentBody'; | ||
import { | ||
updateCommentBodyProgress, | ||
defaultCommentBody, | ||
} from './utils/body/updateBody'; | ||
import type { StepsState } from './utils/steps/calcStepsState'; | ||
|
||
export async function updateCommentBodyProgressFromStepsState< | ||
Name extends EventsWithRepository, | ||
>( | ||
stepsState: StepsState, | ||
context: ProbotEvent<Name>, | ||
reviewflowPrContext: ReviewflowPrContext, | ||
): Promise<void> { | ||
if (reviewflowPrContext.commentBody === defaultCommentBody) return; | ||
|
||
const newCommentBody = updateCommentBodyProgress( | ||
reviewflowPrContext.commentBody, | ||
stepsState, | ||
); | ||
|
||
await updatePrCommentBodyIfNeeded( | ||
context, | ||
reviewflowPrContext, | ||
newCommentBody, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters