Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…or#2506 for github actions workflows.

Fixes up the github actions workflows for pull request regression
test summaries being added as comments to the pull request.
Trying to make it all more robust for other workflow triggers besides pull
requests.
  • Loading branch information
rwest committed Jul 24, 2023
2 parents 4ee1e71 + c3e4ce0 commit eb178e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ jobs:
fi
- name: Prepare Results for PR Comment
if : ${{ github.event_name == 'pull_request' }}
if: ${{ env.REFERENCE_JOB == 'false' }}
env:
PR_NUMBER: ${{ github.event.number || github.event.after || github.event_name }}
run: |
echo $PR_NUMBER > summary.txt
echo "## Regression Testing Results" >> summary.txt
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/annotate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ on:
types:
- completed

run-name: Annotate PR ${{ github.event.workflow_run.event.display_title }}.

jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
steps:
- run: echo 'The triggering workflow passed'
- name: 'Download regression_summary artifact'
Expand Down Expand Up @@ -43,20 +45,19 @@ jobs:
run: unzip regression_summary.zip

- name: 'Get pull request number'
id: pr_number
run: |
echo "PR_NUMBER=$( head -n 1 summary.txt )" >> $GITHUB_ENV
# remove the first line from the file
sed -i '1d' summary.txt
- name: Write summary to pull request as a comment
uses: thollander/actions-comment-pull-request@v2
with:
filePath: summary.txt
pr_number: ${{ env.PR_NUMBER }}

on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The triggering workflow failed'

- name: Report the github.event.workflow_run as json
if: ${{ failure() }}
run: echo $JSON
env:
JSON: ${{ toJson(github.event.workflow_run) }}

0 comments on commit eb178e1

Please sign in to comment.