Skip to content

Commit

Permalink
replace old comment
Browse files Browse the repository at this point in the history
  • Loading branch information
DE7924 committed Dec 4, 2024
1 parent baa261e commit fa04bbe
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,27 @@ jobs:
</table>
</details>
`;
github.rest.issues.createComment({
const { data: comments } = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
repo: context.repo.repo
});
const comment = comments.find(comment => comment.body.includes('## Test Coverage Report'));
if (comment) {
await github.rest.issues.updateComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
} else {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
}
- name: Post failure comment
if: failure()
uses: actions/github-script@v6
Expand All @@ -126,12 +141,27 @@ jobs:
The following checks failed:
${failedStepsDetails}
`;
github.rest.issues.createComment({
const { data: comments } = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
repo: context.repo.repo
});
const comment = comments.find(comment => comment.body.includes('## Code Quality Checks Failed'));
if (comment) {
await github.rest.issues.updateComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
} else {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
}
generate-localizations:
name: Generate localizations.
needs: [code-quality]
Expand Down

0 comments on commit fa04bbe

Please sign in to comment.