Skip to content

Commit ef015c4

Browse files
committed
[feature] Add comprehensive tests and docs for CI failure bot #524
- Add complete test suite with comprehensive coverage for all bot functions - Consolidate documentation into reusable-github-utils.rst as requested by maintainer - Move CI failure bot code from .github/scripts to openwisp_utils package - Add github_actions extra dependency group in setup.py for proper installation - Fix test imports to use correct openwisp_utils.ci_failure_bot module path - Remove noqa comments from Gemini prompt to avoid sending linting artifacts to AI - Implement dynamic branch detection using repo.default_branch instead of hardcoded master - Add null check for deleted fork repositories to prevent AttributeError - Make Gemini API key optional with graceful fallback to static responses - Simplify workflow error handling and clean up formatting - Address all CodeRabbit feedback on exception handling and code quality - Follow OpenWISP documentation patterns with proper structure Addresses all maintainer comments and CodeRabbit suggestions for production readiness. Closes #524
1 parent c64a94a commit ef015c4

File tree

10 files changed

+555
-742
lines changed

10 files changed

+555
-742
lines changed

.github/scripts/ci_failure_bot.py

Lines changed: 0 additions & 287 deletions
This file was deleted.

.github/workflows/ci-failure-bot.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ jobs:
2727
python-version: "3.11"
2828

2929
- name: Install dependencies
30-
# Pin dependency versions for reproducibility
3130
run: |
32-
pip install requests>=2.31.0 PyGithub>=2.0.0 google-generativeai>=0.3.0
31+
pip install -e .[github_actions]
3332
3433
- name: Run CI Failure Bot
3534
env:
@@ -38,4 +37,8 @@ jobs:
3837
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
3938
REPOSITORY: ${{ github.repository }}
4039
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number || '' }}
41-
run: python .github/scripts/ci_failure_bot.py
40+
run: |
41+
set -e # Exit immediately if any command fails
42+
echo "Starting CI Failure Bot..."
43+
python -m openwisp_utils.ci_failure_bot
44+
echo "CI Failure Bot completed successfully"

0 commit comments

Comments
 (0)