Skip to content

Update README.md

Update README.md #1253

name: keep-only-one-comment-on-pr
on: pull_request
permissions:
pull-requests: write # to enable dependabot to write comment
env:
COMMENT_BODY_IDENTIFIER: test
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.number }}
body-includes: ${{ env.COMMENT_BODY_IDENTIFIER }}
- name: Delete comment
if: ${{ steps.fc.outputs.comment-id != 0 }}
uses: jungwinter/comment@v1
with:
type: delete
comment_id: ${{ steps.fc.outputs.comment-id }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `<!-- ${process.env.COMMENT_BODY_IDENTIFIER} -->\nAdd \`release\` label if you want to release when this pull request is merged. (${new Date()}) [keep-only-one-comment-on-pr.yml](${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/keep-only-one-comment-on-pr.yml)`
})