Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Update existing bot comment #1286

Merged
merged 6 commits into from
Oct 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 40 additions & 5 deletions .github/workflows/ubuntu-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
Expand All @@ -36,10 +38,43 @@ jobs:
with:
arguments: "clean build"

- name: Add ubuntu-workflow Build Scan URL to Pull Request
uses: mshick/add-pr-comment@v1
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what a strange usename

id: current-time
with:
format: 'YYYY-MM-DD HH:mm:ss'
utcOffset: "+00:00"

- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
Copy link
Contributor

@piotradamczyk5 piotradamczyk5 Oct 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably for push events, it will be null, but I am not sure if we should take care of it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe skip past push events and only check for a creation of pull request? @pawelpasterz

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.current-time.outputs.formattedTime }}
**Buildscan url for ubuntu-workflow run [${{ github.run_id }}](https://github.com/Flank/flank/actions/runs/${{ github.run_id }})**
${{ needs.build.outputs.build-scan-url }}

- name: Update comment
if: ${{ steps.fc.outputs.comment-id != 0 }}
uses: peter-evans/create-or-update-comment@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
message: |
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
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 }}