From b62ecfd6e03f2353281d16b65d184e2b1698bbd6 Mon Sep 17 00:00:00 2001 From: Pawel Pasterz Date: Thu, 29 Oct 2020 07:40:38 +0100 Subject: [PATCH 1/5] Update existing comment --- .github/workflows/ubuntu-workflow.yml | 35 ++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ubuntu-workflow.yml b/.github/workflows/ubuntu-workflow.yml index 571aa27b92..b8dd61646a 100644 --- a/.github/workflows/ubuntu-workflow.yml +++ b/.github/workflows/ubuntu-workflow.yml @@ -36,10 +36,37 @@ jobs: with: arguments: "clean build" - - name: Add ubuntu-workflow Build Scan URL to Pull Request - uses: mshick/add-pr-comment@v1 + - name: Get Time + id: time + uses: nanzm/get-time-action@v1.0 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - message: | + timeZone: 0 + format: 'YYYY-MM-DD-HH-mm-ss' + + - name: Find Comment + uses: peter-evans/find-comment@v1 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: Buildscan url for ubuntu-workflow run + + - name: Create comment + if: ${{ steps.fc.outputs.comment-id == 0 }} + uses: peter-evans/create-or-update-comment@v1 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + Timestamp: ${{ steps.time.outputs.time }} + **Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})** + ${{ steps.build.outputs.build-scan-url }} + + - name: Update comment + if: ${{ steps.fc.outputs.comment-id != 0 }} + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + body: | + Timestamp: ${{ steps.time.outputs.time }} **Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})** ${{ steps.build.outputs.build-scan-url }} From 0bc3a49849805be2291560aa75f78c043de93dfe Mon Sep 17 00:00:00 2001 From: Pawel Pasterz Date: Thu, 29 Oct 2020 07:45:58 +0100 Subject: [PATCH 2/5] Change message --- .github/workflows/ubuntu-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-workflow.yml b/.github/workflows/ubuntu-workflow.yml index b8dd61646a..a0d28bda0e 100644 --- a/.github/workflows/ubuntu-workflow.yml +++ b/.github/workflows/ubuntu-workflow.yml @@ -41,7 +41,7 @@ jobs: uses: nanzm/get-time-action@v1.0 with: timeZone: 0 - format: 'YYYY-MM-DD-HH-mm-ss' + format: 'YYYY-MM-DD HH:mm:ss' - name: Find Comment uses: peter-evans/find-comment@v1 @@ -67,6 +67,6 @@ jobs: with: comment-id: ${{ steps.fc.outputs.comment-id }} body: | - Timestamp: ${{ steps.time.outputs.time }} + **Timestamp:** ${{ steps.time.outputs.time }} **Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})** ${{ steps.build.outputs.build-scan-url }} From 8e6b7b31aef3ef607204afc15c860e085a9124c9 Mon Sep 17 00:00:00 2001 From: Pawel Pasterz Date: Thu, 29 Oct 2020 07:54:12 +0100 Subject: [PATCH 3/5] Change mode to replace --- .github/workflows/ubuntu-workflow.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-workflow.yml b/.github/workflows/ubuntu-workflow.yml index a0d28bda0e..fe7e0b2466 100644 --- a/.github/workflows/ubuntu-workflow.yml +++ b/.github/workflows/ubuntu-workflow.yml @@ -40,7 +40,7 @@ jobs: id: time uses: nanzm/get-time-action@v1.0 with: - timeZone: 0 + timeZone: 8 format: 'YYYY-MM-DD HH:mm:ss' - name: Find Comment @@ -57,7 +57,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} body: | - Timestamp: ${{ steps.time.outputs.time }} + **Timestamp:** ${{ steps.time.outputs.time }} **Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})** ${{ steps.build.outputs.build-scan-url }} @@ -66,6 +66,7 @@ jobs: uses: peter-evans/create-or-update-comment@v1 with: comment-id: ${{ steps.fc.outputs.comment-id }} + edit-mode: replace body: | **Timestamp:** ${{ steps.time.outputs.time }} **Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})** From 50c54c69da9c29cd93f4828b74a61be4bc139e14 Mon Sep 17 00:00:00 2001 From: Pawel Pasterz Date: Thu, 29 Oct 2020 08:05:33 +0100 Subject: [PATCH 4/5] Change time action --- .github/workflows/ubuntu-workflow.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ubuntu-workflow.yml b/.github/workflows/ubuntu-workflow.yml index fe7e0b2466..16af5b1424 100644 --- a/.github/workflows/ubuntu-workflow.yml +++ b/.github/workflows/ubuntu-workflow.yml @@ -36,12 +36,12 @@ jobs: with: arguments: "clean build" - - name: Get Time - id: time - uses: nanzm/get-time-action@v1.0 + - name: Get current time + uses: 1466587594/get-current-time@v2 + id: current-time with: - timeZone: 8 format: 'YYYY-MM-DD HH:mm:ss' + utcOffset: "+00:00" - name: Find Comment uses: peter-evans/find-comment@v1 @@ -57,7 +57,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} body: | - **Timestamp:** ${{ steps.time.outputs.time }} + **Timestamp:** ${{ steps.current-time.outputs.formattedTime }} **Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})** ${{ steps.build.outputs.build-scan-url }} @@ -68,6 +68,6 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} edit-mode: replace body: | - **Timestamp:** ${{ steps.time.outputs.time }} + **Timestamp:** ${{ steps.current-time.outputs.formattedTime }} **Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})** ${{ steps.build.outputs.build-scan-url }} From 8d1d99994b6faa6a9ab9457a95f9956a7a7680b4 Mon Sep 17 00:00:00 2001 From: Pawel Pasterz Date: Thu, 29 Oct 2020 09:22:22 +0100 Subject: [PATCH 5/5] Refactor --- .github/workflows/ubuntu-workflow.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-workflow.yml b/.github/workflows/ubuntu-workflow.yml index 16af5b1424..cf11a74a28 100644 --- a/.github/workflows/ubuntu-workflow.yml +++ b/.github/workflows/ubuntu-workflow.yml @@ -11,6 +11,8 @@ on: jobs: build: runs-on: ubuntu-latest + outputs: + build-scan-url: ${{ steps.build.outputs.build-scan-url }} steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.5.0 @@ -36,6 +38,11 @@ jobs: with: arguments: "clean build" + publish-scan-url: + needs: [ build ] + if: ${{ github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + steps: - name: Get current time uses: 1466587594/get-current-time@v2 id: current-time @@ -59,7 +66,7 @@ jobs: body: | **Timestamp:** ${{ steps.current-time.outputs.formattedTime }} **Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})** - ${{ steps.build.outputs.build-scan-url }} + ${{ needs.build.outputs.build-scan-url }} - name: Update comment if: ${{ steps.fc.outputs.comment-id != 0 }} @@ -70,4 +77,4 @@ jobs: body: | **Timestamp:** ${{ steps.current-time.outputs.formattedTime }} **Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})** - ${{ steps.build.outputs.build-scan-url }} + ${{ needs.build.outputs.build-scan-url }}