Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Nov 14, 2024
1 parent 2da502d commit db55a66
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/ecosystem-ci-from-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ jobs:
needs: [init, execute-selected-suite, execute-all]
if: always()
steps:
- id: update-comment
uses: actions/github-script@v7
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.ECOSYSTEM_CI_ACCESS_TOKEN }}
result-encoding: string
Expand Down Expand Up @@ -233,17 +232,32 @@ jobs:
}).join("\n")}
`
await github.rest.issues.deleteComment({
// delete previous comment and create a new one when run by manually
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: 'core',
comment_id: ${{ steps.update-comment.outputs.result || needs.init.outputs.comment-id }}
issue_number: context.payload.inputs.prNumber
})
const lastComment = comments.reverse().find(comment =>
comment.body.includes('Ran ecosystem CI:')
)
if (lastComment) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: 'core',
comment_id: lastComment.id
})
} else {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: 'core',
comment_id: ${{ needs.init.outputs.comment-id }}
})
}
const { data: comment } = await github.rest.issues.createComment({
issue_number: context.payload.inputs.prNumber,
owner: context.repo.owner,
repo: 'core',
body
})
return comment.id

0 comments on commit db55a66

Please sign in to comment.