Check Runs
Safe Settings creates check runs in the admin repository to provide visibility into every sync operation.Check Run Types
Safe-Settings Check Run
Created after every sync operation (webhook-triggered or scheduled). Location: Admin repository, latest commit on default branch Name: “Safe-Settings” Information provided:- Execution timestamp
- Success or failure status
- List of errors (if any)
- Repositories processed
- Configuration changes applied
lib/settings.js:129-174
Safe-Setting Validator Check Run
Created for pull request validation in the admin repository. Location: PR branch in admin repository Name: “Safe-setting validator” Information provided:- Validation results (pass/fail)
- Dry-run simulation output
- Proposed changes by repository
- Validation errors
- Custom validator results
index.js:199-209 and index.js:541-613
Check Run Lifecycle
const res = await context.octokit.checks.create({
owner: payload.repository.owner.login,
repo: payload.repository.name,
name: 'Safe-setting validator',
head_sha
})
let params = {
owner: payload.repository.owner.login,
repo: payload.repository.name,
check_run_id: payload.check_run.id,
status: 'in_progress',
started_at: new Date().toISOString(),
output: { title: 'Starting NOP', summary: 'initiating...' }
}
await context.octokit.checks.update(params)
const params = {
owner: payload.repository.owner.login,
repo: payload.repository.name,
check_run_id: payload.check_run.id,
status: 'completed',
conclusion: error ? 'failure' : 'success',
completed_at: new Date().toISOString(),
output: {
title: error ? 'Safe-Settings Dry-Run Finished with Error' : 'Safe-Settings Dry-Run Finished with success',
summary: renderedCommentMessage
}
}
Viewing Check Runs
Via GitHub UI
Via GitHub UI
- Navigate to your admin repository
- Click on the “Commits” tab
- Click on the ✓ or ✗ icon next to a commit
- Select the “Safe-Settings” or “Safe-setting validator” check
- View detailed output
Via Pull Requests
Via Pull Requests
- Open a pull request in the admin repository
- Scroll to the “Checks” section at the bottom
- Click on “Safe-setting validator”
- View validation results and proposed changes
Via GitHub API
Via GitHub API
Check Run Output Examples
Successful Sync
Failed Sync
README.md:442-452
PR Validation Output
README.md:427-439
Check Run Limitations
Source:lib/settings.js:161
PR Comments
WhenENABLE_PR_COMMENT=true, Safe Settings posts detailed comments on pull requests in the admin repository.
Comment Structure
Source:lib/settings.js:262-294
Enabling PR Comments
.env
README.md:544-547
Comment Features
- Visual indicators: ✋ for changes, ❗ for errors
- Grouped by plugin: Organized by configuration type
- JSON details: Shows exact changes in JSON format
- Size-limited: Truncated if exceeds 65,535 characters
lib/settings.js:262-294
Logging
Safe Settings uses Probot’s logging system to provide detailed operational logs.Log Levels
Configure logging verbosity with theLOG_LEVEL environment variable:
| Level | Description | Use Case |
|---|---|---|
error | Only errors | Production (minimal logs) |
warn | Warnings and errors | Production (standard) |
info | Informational messages | Production (recommended) |
debug | Detailed debugging info | Troubleshooting |
trace | Maximum verbosity | Development/debugging |
README.md:524-527
.env
What Gets Logged
Info Level
- Webhook events received
- Repositories processed
- Configuration files loaded
- Sync operations started/completed
Debug Level
- Configuration merge details
- API endpoint calls
- Validation results
- Bot detection logic
- Repository filtering decisions
index.js and lib/settings.js
Error Level
- Configuration loading failures
- API errors
- Validation failures
- Check run creation failures
lib/settings.js:176-184
Log Examples
Webhook Event Processing
Validation During PR
Monitoring Best Practices
Set up notifications for failed check runs
Set up notifications for failed check runs
Configure GitHub to notify you when check runs fail:
- Go to admin repository settings
- Enable branch protection on default branch
- Require “Safe-Settings” check to pass
- Set up email/Slack notifications for failed checks
Regularly review check run history
Regularly review check run history
Establish a routine to review:
- Frequency of failures
- Common error patterns
- Repositories frequently requiring resync
- Performance trends
Monitor API rate limits
Monitor API rate limits
Watch for rate limiting issues:Adjust CRON frequency if approaching limits.
Enable PR comments for transparency
Enable PR comments for transparency
Set
ENABLE_PR_COMMENT=true to:- Provide visibility to all team members
- Document what changes will occur
- Enable review before merging
- Create audit trail of changes
Use appropriate log levels
Use appropriate log levels
- Production:
infoorwarn - Troubleshooting:
debug - Development:
trace
trace in production due to log volume.Archive logs for compliance
Archive logs for compliance
If your organization requires audit trails:
- Configure log retention policies
- Export logs to external systems (Splunk, ELK, etc.)
- Store check run history
- Document configuration changes
Metrics to Monitor
Operational Metrics
Sync Success Rate
Percentage of successful sync operations vs. failures.Target: > 95%Monitor via: Check run conclusions
Processing Time
Time taken to complete full sync operations.Target: < 30 minutes for 1000 reposMonitor via: Check run timestamps
Error Frequency
Number of errors per day/week.Target: < 5 per dayMonitor via: Check run failures
Affected Repositories
Number of repositories requiring changes per sync.Target: Decreasing over timeMonitor via: Check run summaries
Configuration Metrics
- Configuration drift rate: How often manual changes are reverted
- Validation failure rate: PR validations that fail
- Merge frequency: How often configuration PRs are merged
- Time to merge: Duration from PR creation to merge
Advanced Monitoring
External Monitoring Integration
Integrate Safe Settings with external monitoring tools:Webhook Forwarding
Configure GitHub to send check run webhooks to monitoring systems:Log Aggregation
Forward logs to centralized logging:Prometheus Metrics
Expose metrics for Prometheus:Dashboard Example
Create a monitoring dashboard with:- Status Panel: Current state of last sync
- Error Log: Recent errors and failures
- Sync History: Timeline of sync operations
- Repository Coverage: Percentage of repos successfully synced
- API Usage: GitHub API rate limit consumption
Troubleshooting with Monitoring Data
Alerting Strategies
Critical Alerts
Trigger immediate notification:- All sync operations failing
- Admin repository inaccessible
- GitHub App authentication failures
- Scheduled sync not running
Warning Alerts
Trigger review within 24 hours:- Individual repository failures
- Validation errors in PRs
- Approaching API rate limits
- Degraded performance
Informational Alerts
Trigger weekly review:- Configuration changes merged
- New repositories added
- Drift detected and corrected
- Usage statistics
Monitoring Checklist
- Check runs are being created for every sync operation
- Failed check runs trigger notifications
- PR comments are enabled for configuration changes
- Log level is appropriate for environment
- Logs are being persisted and archived
- Dashboard or monitoring system is configured
- Alerts are configured for critical failures
- Team knows where to find check runs and logs
- Regular reviews of check run history are scheduled
- Metrics are being tracked over time