Overview
GitHub Actions deployment provides:- No infrastructure - Runs entirely on GitHub’s infrastructure
- Scheduled sync - Automated periodic synchronization
- Manual triggers - Run sync on-demand via
workflow_dispatch - Simple setup - Just add a workflow file
- Cost-effective - Uses GitHub Actions minutes
- Version pinning - Control which Safe Settings version to use
This method runs Safe Settings in sync mode only. For real-time webhook processing, use Docker, AWS Lambda, or Kubernetes.
Prerequisites
- GitHub repository with Actions enabled (recommended:
.githubrepo) - GitHub App created with proper permissions
- Admin repository configured with Safe Settings configuration files
- GitHub App credentials stored as repository secrets
Quick Setup
SAFE_SETTINGS_APP_ID=123456
SAFE_SETTINGS_PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----...
SAFE_SETTINGS_GITHUB_CLIENT_SECRET=your-client-secret
SAFE_SETTINGS_GH_ORG=your-organization
SAFE_SETTINGS_APP_ID=123456
SAFE_SETTINGS_GITHUB_CLIENT_ID=Iv1.xxx
APP_ID is not sensitive and can be stored as a variable instead of a secret for better visibility.name: Safe Settings Sync
on:
schedule:
# Run every 4 hours
- cron: "0 */4 * * *"
workflow_dispatch: {}
jobs:
safeSettingsSync:
runs-on: ubuntu-latest
env:
# Version/tag of github/safe-settings repo to use
SAFE_SETTINGS_VERSION: 2.1.17
# Path on runner where safe-settings code will be downloaded
SAFE_SETTINGS_CODE_DIR: ${{ github.workspace }}/.safe-settings-code
steps:
# Checkout admin repo for safe-settings config
- uses: actions/checkout@v4
# Checkout safe-settings repo
- uses: actions/checkout@v4
with:
repository: github/safe-settings
ref: ${{ env.SAFE_SETTINGS_VERSION }}
path: ${{ env.SAFE_SETTINGS_CODE_DIR }}
# Setup Node.js
- uses: actions/setup-node@v4
with:
node-version: '20'
# Install dependencies
- run: npm install
working-directory: ${{ env.SAFE_SETTINGS_CODE_DIR }}
# Run full sync
- run: npm run full-sync
working-directory: ${{ env.SAFE_SETTINGS_CODE_DIR }}
env:
GH_ORG: ${{ vars.SAFE_SETTINGS_GH_ORG }}
APP_ID: ${{ vars.SAFE_SETTINGS_APP_ID }}
PRIVATE_KEY: ${{ secrets.SAFE_SETTINGS_PRIVATE_KEY }}
GITHUB_CLIENT_ID: ${{ vars.SAFE_SETTINGS_GITHUB_CLIENT_ID }}
GITHUB_CLIENT_SECRET: ${{ secrets.SAFE_SETTINGS_GITHUB_CLIENT_SECRET }}
ADMIN_REPO: .github
CONFIG_PATH: safe-settings
DEPLOYMENT_CONFIG_FILE: ${{ github.workspace }}/safe-settings/deployment-settings.yml
git add .github/workflows/safe-settings-sync.yml
git commit -m "Add Safe Settings sync workflow"
git push
Workflow Configuration
Schedule Frequency
Adjust the cron schedule to control sync frequency:GitHub Actions uses UTC timezone. Adjust your schedule accordingly.
Manual Triggers
Theworkflow_dispatch event allows manual execution:
- Go to Actions tab
- Select “Safe Settings Sync” workflow
- Click “Run workflow”
Safe Settings Version
Pin to a specific version for stability:Configuration Paths
Standard Configuration
Use default paths in your.github repository:
Custom Admin Repository
Use a different repository:Multiple Configuration Directories
Run different configurations:Environment Variables
Required Variables
| Variable | Type | Description |
|---|---|---|
GH_ORG | Variable | Organization name |
APP_ID | Variable | GitHub App ID |
PRIVATE_KEY | Secret | GitHub App private key |
GITHUB_CLIENT_ID | Variable | GitHub OAuth client ID |
GITHUB_CLIENT_SECRET | Secret | GitHub OAuth client secret |
Optional Variables
| Variable | Default | Description |
|---|---|---|
ADMIN_REPO | admin | Repository containing configuration |
CONFIG_PATH | .github | Path to configuration directory |
SETTINGS_FILE_PATH | settings.yml | Settings file name |
DEPLOYMENT_CONFIG_FILE | - | Path to deployment settings |
LOG_LEVEL | info | Logging level |
GHE_HOST | - | GitHub Enterprise Server host |
GitHub Enterprise Server
For GHES deployments:Advanced Workflows
Multiple Organizations
Sync settings for multiple organizations:Dry Run Mode
Validate changes without applying:Notification on Failure
Send notifications when sync fails:Matrix Strategy for Multiple Environments
Monitoring
View Workflow Runs
Monitor sync execution:- Go to repository’s Actions tab
- Select Safe Settings Sync workflow
- View run history and logs
Check Run Status
Use GitHub CLI:Workflow Status Badge
Add a badge to your README:Troubleshooting
Workflow Not Running
Cron Schedule Not Triggering:- GitHub Actions may delay scheduled workflows during high load
- Scheduled workflows don’t run on disabled repositories
- Workflow must be in default branch to run on schedule
workflow_dispatch for immediate testing:
Authentication Errors
Invalid App ID or Private Key: Verify secrets are set correctly:Node Version Issues
Safe Settings requires Node.js 18+:Configuration File Not Found
Ensure paths are correct:Timeout Issues
For large organizations, increase timeout:Cost Considerations
GitHub Actions Minutes
GitHub Actions usage depends on your plan:| Plan | Included Minutes | Price per Additional Minute |
|---|---|---|
| Free | 2,000/month | N/A |
| Pro | 3,000/month | $0.008 |
| Team | 3,000/month | $0.008 |
| Enterprise | 50,000/month | $0.008 |
- Average sync: 2-5 minutes
- Every 4 hours: ~30 runs/month
- Total: ~60-150 minutes/month
Most organizations will stay within free tier limits with this usage pattern.
Optimization Tips
- Adjust schedule frequency based on drift tolerance
- Use repository restrictions to limit scope
- Combine with webhook-based deployment for real-time updates + drift prevention
Combining with Webhook Deployment
For production environments, combine GitHub Actions with webhook-based deployment:- Webhooks (Docker/Lambda/K8s): Real-time event processing
- GitHub Actions: Periodic drift prevention
- Immediate response to configuration changes
- Regular drift detection and correction
- Redundancy if webhooks fail
Next Steps
Configure Settings
Set up your repository settings
Docker Deployment
Add webhook processing
AWS Lambda
Serverless webhooks + scheduled sync
GitHub Actions Docs
Learn more about GitHub Actions