Skip to content

Commit

Permalink
ci: add multiple comment sctructures
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbsa committed Sep 6, 2023
1 parent 1d9cc4a commit bccd30f
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/publish-test-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
outputs:
pr-number: ${{ steps.set-env.outputs.pr-number }}
workflow-id: ${{ steps.set-env.outputs.workflow-id }}
failure-reason: ${{ steps.set-env.outputs.failure-reason || '' }}
failed-builds: ${{ steps.set-env.outputs.failed-builds || ''}}
steps:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: Download artifact
Expand Down Expand Up @@ -43,6 +45,8 @@ jobs:
run: |
echo "pr-number=$(cat ./pr_number)" >> $GITHUB_OUTPUT
echo "workflow-id=$(cat ./workflow_id)" >> $GITHUB_OUTPUT
echo "failure-reason=$(cat ./failure-reason)" >> $GITHUB_OUTPUT
echo "failed-builds=$(cat ./failed-builds)" >> $GITHUB_OUTPUT
comment-pr:
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -74,14 +78,38 @@ jobs:
body: |
<h1>Automated tests Summary</h1>
<h3><strong>:white_check_mark:</strong> All the CI tests have passed!</h3>
- name: Failing build comment
if: ${{ github.event.workflow_run.conclusion == 'failure' && needs.get-pr-data.outputs.failure-reason == 'build-package' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ needs.get-pr-data.outputs.pr-number }}
body: |
<h1> Automated tests Summary</h1>
<h3><strong>:rotating_light:</strong> Test workflow has failed some package build process</h3>
___
[Click here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ needs.get-pr-data.outputs.workflow-id }}) to check the action test reports
- name: Failing install comment
if: ${{ github.event.workflow_run.conclusion == 'failure' && needs.get-pr-data.outputs.failure-reason == 'bbb-installation' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ needs.get-pr-data.outputs.pr-number }}
body: |
<h1> Automated tests Summary</h1>
<h3><strong>:rotating_light:</strong> Test workflow has failed to install BBB</h3>
___
[Click here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ needs.get-pr-data.outputs.workflow-id }}) to check the action test reports
- name: Failing tests comment
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
if: ${{ github.event.workflow_run.conclusion == 'failure' && needs.get-pr-data.outputs.failure-reason == '' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ needs.get-pr-data.outputs.pr-number }}
body: |
<h1> Automated tests Summary</h1>
<h3><strong>:rotating_light:</strong> Test workflow has failed</h3>
<h3><strong>:rotating_light:</strong> There're some failed tests</h3>
___
Expand Down

0 comments on commit bccd30f

Please sign in to comment.