Actions
Automated actions to take on validation results
Actions are automated tasks that Rulesets performs based on validation results. The on_success
and on_failure
properties of a rule define which actions to take when validations pass or fail.
Action Structure
Actions are defined in the on_success
and on_failure
arrays:
Each action has a type (its key) and type-specific parameters.
Available Action Types
Comment
Add or update a comment on the PR
Label
Add or remove labels from the PR
Assign
Assign users to the PR
Request Review
Request reviews from users or teams
Checks
Create or update check runs
Close
Close the PR
Merge
Merge the PR
Templates
Actions support template variables that are replaced with dynamic content:
{{ pull_request.user.login }}
- PR author’s username{{ pull_request.title }}
- PR title{{ pull_request.body }}
- PR description{{ pull_request.number }}
- PR number{{ repository.name }}
- Repository name{{ repository.full_name }}
- Full repository name (owner/repo){{ validation_summary }}
- Summary of all validation results
Example Use Cases
Adding Comments
Provide feedback on validation results:
Managing Labels
Add or remove labels based on validation results:
Requesting Reviews
Automatically request reviews when validations pass:
Creating Checks
Update GitHub Checks with validation results:
Advanced Example
A comprehensive automation workflow:
This example creates a complete workflow for production PRs that:
- Validates PR title format and required approvals
- Manages labels based on validation status
- Adds comments with feedback when validation fails
- Creates check runs to show status in GitHub UI