Skip to content

Commit

Permalink
ci: add comment message in tests (#26364)
Browse files Browse the repository at this point in the history
  • Loading branch information
a0m0rajab authored Oct 3, 2023
1 parent c9cd81f commit 8d7f2db
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/intelligent-tests-pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: intelligent-tests-pr
on:
workflow_dispatch:
pull_request:
pull_request_target:
types: [labeled, opened, synchronize, reopened, review_requested]

permissions:
Expand All @@ -26,15 +26,44 @@ jobs:
cat combined_test_results.txt
- name: New Failures Introduced
id: ci_output
run: |
find . -name "new_failures_*.txt" -exec cat {} + > combined_failures.txt
if [ -s combined_failures.txt ]
then
echo "This PR introduces the following new failing tests:"
cat combined_failures.txt
{
echo 'MESSAGE<<EOF'
echo "# Failed tests:"
echo "This PR introduces the following new failing tests:"
cat combined_failures.txt
echo EOF
} >> "$GITHUB_OUTPUT"
else
echo "This PR does not introduce any new test failures! Yippee!"
echo "MESSAGE=This pull request does not result in any additional test failures. Congratulations!" >> "$GITHUB_OUTPUT"
fi
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: <!--- CI Output -->

- name: Create or update comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Thank you for this PR, here is the CI results:
-------------
${{ steps.ci_output.outputs.MESSAGE}}
<!--- CI Output -->
edit-mode: replace

run_tests:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 8d7f2db

Please sign in to comment.