From a61c7908acc43a051777fa238837561be8dcb09f Mon Sep 17 00:00:00 2001 From: selankon Date: Mon, 12 Feb 2024 15:18:28 +0100 Subject: [PATCH] chore(gh-action): enable artifact comment --- .github/workflows/publish_artifacts.yml | 29 ++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish_artifacts.yml b/.github/workflows/publish_artifacts.yml index 6d4c5471..653a5658 100644 --- a/.github/workflows/publish_artifacts.yml +++ b/.github/workflows/publish_artifacts.yml @@ -2,7 +2,9 @@ name: Publish artifacts on: pull_request: - types: [ labeled ] + types: + - labeled + - synchronize jobs: build-artifacts: @@ -10,6 +12,24 @@ jobs: runs-on: ubuntu-latest steps: + - name: Find a PR comment + uses: peter-evans/find-comment@v2 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + body-includes: 'Artifacts deployed: ' + - name: Delete Comment + uses: actions/github-script@v6 + continue-on-error: true + if: steps.fc.outputs.comment-id != 0 + with: + script: | + github.rest.issues.deleteComment({ + comment_id: ${{ steps.fc.outputs.comment-id }}, + owner: context.repo.owner, + repo: context.repo.repo, + }) + - uses: actions/checkout@v3 - name: Install node @@ -26,3 +46,10 @@ jobs: with: name: build-artifacts path: build/ + + - name: Update the PR comment + uses: peter-evans/create-or-update-comment@v2 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + Artifacts deployed: ${{ steps.artifact-upload-step.outputs.artifact-url }}