Skip to content

Commit

Permalink
fix: update the last comment
Browse files Browse the repository at this point in the history
  • Loading branch information
gcharest authored Sep 9, 2024
1 parent 12e5599 commit 9620644
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,42 @@ jobs:
NOTIFY_OPS_CHANNEL_ID: ${{ secrets.NOTIFY_OPS_CHANNEL_ID }}
SRE_BOT_EMAIL: ${{ secrets.SRE_BOT_EMAIL }}
AWS_ORG_ACCOUNT_ROLE_ARN: ${{ secrets.AWS_ORG_ACCOUNT_ROLE_ARN }}

- name: Find previous comment
id: find-comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const { data: comments } = await github.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
comments.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
const comment = comments.find(comment => comment.user.login === 'github-actions[bot]' && comment.body.includes('Lint, format and test code results'));
return comment ? comment.id : null;
- name: Update comment
if: steps.find-comment.outputs.result != 'null'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
await github.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: steps.find-comment.outputs.result,
body: 'Lint, format and test code results: ...',
});
- name: Create comment
if: steps.find-comment.outputs.result == 'null'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'Lint, format and test code results: ...',
});

0 comments on commit 9620644

Please sign in to comment.