@@ -37,17 +37,28 @@ jobs:
3737 fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
3838 - run : unzip pr.zip
3939
40- - name : ' Comment on PR'
41- uses : actions/github-script@v3
40+
41+ - name : Find Comment
42+ continue-on-error : true
43+ uses : peter-evans/find-comment@v1
44+ id : find_comment
4245 with :
43- github-token : ${{ secrets.GITHUB_TOKEN }}
44- script : |
45- var fs = require('fs');
46- var issue_number = Number(fs.readFileSync('./NR'));
47- await github.issues.createComment({
48- owner: context.repo.owner,
49- repo: context.repo.repo,
50- issue_number: issue_number,
51- body: 'Everything is OK. Thank you for the PR!'
52- });
46+ token : ${{ secrets.GITHUB_TOKEN }}
47+ issue-number : ${{ github.event.number }} # ${{ steps.output_result.outputs.pull_request_number }}
48+ comment-author : ' github-actions[bot]'
49+
50+ - name : Create or update comment
51+ # I forked a version of this repo to implement the above mentioned conditional
52+ uses : peter-evans/create-or-update-comment@v1
53+ with :
54+ token : ${{ secrets.GITHUB_TOKEN }}
55+ issue-number : ${{ github.event.number }}
56+ # If the comment-id is blank, this will create a new comment.
57+ # Otherwise, it will update the comment.
58+ comment-id : ${{ steps.find_comment.outputs.comment-id }}
59+ body : |
60+ Create or update this comment.
61+ edit-mode : replace
62+ if : success()
63+
5364
0 commit comments