Overview
When a pull request is created or updated, the workflow automatically:- Validates code changes
- Runs automated tests (Promptfoo, Redteam)
- Performs quality checks (SonarQube)
- Validates pull request body
- Provides feedback to developers
Reusable Components Used
This workflow leverages the following reusable components:- pull-request-check.yaml: Main reusable workflow that orchestrates PR validation
- setup-project: Sets up Python environment and resolves project metadata
- check-action-pinning: Validates GitHub Actions are pinned to SHA versions
- code-quality: Runs pylint, pytest, and hadolint checks
- sonar-check: Performs SonarCloud code analysis (conditional)
- promptfoo-evaluation: Runs prompt evaluation tests (conditional)
- promptfoo-redteaming: Runs security and adversarial tests (conditional)
- security-check: Scans filesystem for vulnerabilities with Trivy
- validate-pull-request-body: Validates PR body against template
Workflow Flowchart
Workflow Triggers
The PR workflow is triggered on:- PR Opened: When a new pull request is opened
- PR Updated: When new commits are pushed to the PR branch
- PR Reopened: When a closed PR is reopened
- PR Ready for Review: When PR is marked ready for review
- Manual Trigger: Via workflow_dispatch
maindeveloprelease/**
Validation Steps
1. Code Quality Checks
The workflow uses the reusablepull-request-check.yaml workflow which includes:
- SonarQube Analysis: Code quality and security scanning
- Source Code Analysis: Static analysis of source code
- Timeout: 360 minutes maximum execution time
2. Testing
Comprehensive testing is performed:- Promptfoo Tests: Agent prompt and response validation
- Configuration:
promptfoo_config/*.yaml
- Configuration:
- Redteam Tests: Security and adversarial testing
- Configuration:
redteam.yaml - Number of tests: 5
- Configuration:
3. Pull Request Body Validation
For feature, hotfix, and bugfix branches, the PR body is validated to ensure:- Required information is present
- Description follows standards
- Changes are properly documented
- PRs from
baasbot - PRs with
ci skiplabel
Workflow Configuration
The pull request check workflow is defined in.github/workflows/pull-request-check.yaml:
[!TIP] See the Configurations page for required secrets and template files.
Configuration Options
SonarQube
Enable SonarQube analysis:Promptfoo Testing
Enable prompt and response validation:Redteam Testing
Enable security and adversarial testing:Required Checks
Before a PR can be merged, these checks must pass:- ✅ Code quality checks (SonarQube)
- ✅ All tests passing (Promptfoo, Redteam)
- ✅ PR body validation (for feature/hotfix/bugfix branches)
- ✅ Code review approval
- ✅ No security vulnerabilities
PR Status Checks
The workflow provides status checks that must pass before merge:Verify
Verify
Comprehensive validation including SonarQube, Promptfoo, and Redteam tests
Validate PR Body
Validate PR Body
Ensures PR description meets standards for feature/hotfix/bugfix branches
Best Practices
- Small PRs: Keep PRs focused and small for easier review
- Descriptive Titles: Use clear, descriptive PR titles
- Complete PR Body: Include detailed description for feature/hotfix/bugfix PRs
- Test Coverage: Ensure new code has adequate test coverage
- Documentation: Update documentation for new features
Troubleshooting
Failed Checks
If PR checks fail:- Review the error messages in the PR status
- Check SonarQube reports for quality issues
- Review Promptfoo test failures
- Address Redteam security findings
- Fix PR body validation issues
- Push fixes to the PR branch
Skipping Checks
To skip PR body validation, add theci skip label to your PR.