Skip to content

Commit

Permalink
Only create single issue if any CI fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski committed Sep 24, 2024
1 parent 4df89d1 commit 8fe4da4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/cron_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ jobs:
- name: Test
run: pytest

# Create an issue if tests fail
- name: Create GitHub issue if tests fail
if: failure() # Only run if the tests fail
create_issue:
name: Create GitHub issue if any test fails
runs-on: ubuntu-latest
needs: [test] # This ensures it waits for all matrix jobs to complete
if: ${{ failure() }} # Only run this job if any previous jobs fail
steps:
- name: Create GitHub issue
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"title": "CI Test Failure",
"body": "The CI tests have failed. Please check the logs for details.",
"body": "One or more matrix jobs have failed. Please check the logs for details.",
"labels": ["bug"]
}' \
https://api.github.com/repos/${{ github.repository }}/issues

0 comments on commit 8fe4da4

Please sign in to comment.