This guide explains how to set up hubcap.py to run on GitHub Actions instead of Heroku.
The GitHub Actions workflow (hubcap-scheduler.yml) supports:
- Scheduled execution: Runs every hour automatically in production
- Manual execution: Can be triggered manually for either test or production
- Dry-run capability: Can run without creating PRs for testing
- Environment isolation: Separate configurations for test and production
In your GitHub repository, go to Settings > Environments and create two environments:
- Name:
production - Protection rules:
- ✅ Required reviewers (recommended for production safety)
- ✅ Wait timer: 0 minutes
- Environment secrets: See step 2 below
- Name:
test - Protection rules: None (allows automatic execution)
- Environment secrets: See step 2 below
Each environment needs a HUBCAP_CONFIG secret with the appropriate configuration.
Secret name: HUBCAP_CONFIG
Secret value:
{
"user": {
"name": "dbt-hubcap",
"email": "buildbot@fishtownanalytics.com",
"token": "ghp_your_production_token_here"
},
"org": "dbt-labs",
"repo": "hub.getdbt.com",
"push_branches": true,
"one_branch_per_repo": true
}Secret name: HUBCAP_CONFIG
Secret value:
{
"user": {
"name": "dbt-hubcap-test",
"email": "buildbot+test@fishtownanalytics.com",
"token": "ghp_your_test_token_here"
},
"org": "dbt-labs",
"repo": "hub.getdbt.com-test",
"push_branches": true,
"one_branch_per_repo": true
}Create two GitHub Personal Access Tokens:
- Scopes:
repo,workflow - Expiration: Set appropriate expiration
- Access: Must have write access to
dbt-labs/hub.getdbt.com
- Scopes:
repo,workflow - Expiration: Set appropriate expiration
- Access: Must have write access to
dbt-labs/hub.getdbt.com-test
The workflow runs automatically every hour at :00 in production mode.
You can manually trigger the workflow with different options:
gh workflow run "Hubcap Scheduler" \
--field environment=test \
--field dry_run=truegh workflow run "Hubcap Scheduler" \
--field environment=test \
--field dry_run=falsegh workflow run "Hubcap Scheduler" \
--field environment=production \
--field dry_run=false- Go to Actions > Hubcap Scheduler
- Click Run workflow
- Select:
- Environment:
testorproduction - Dry run:
true(no PRs) orfalse(create PRs)
- Environment:
- Click Run workflow
- View execution history in Actions tab
- Each run shows environment, duration, and status
- Failed runs will show error details in logs
Each execution saves:
hubcap.log: Complete execution logtarget/: Cloned repositories and generated files- Retention: 30 days
Configure notifications in repository settings:
- Settings > Notifications
- Enable workflow failure notifications
- Set up Slack/email integration if needed
Token Permission Errors
- Verify token has
repoandworkflowscopes - Check token has write access to target repository
- Ensure token hasn't expired
Configuration Errors
- Validate JSON syntax in
HUBCAP_CONFIGsecrets - Check repository names match intended targets
- Verify user email and name are correct
Execution Failures
- Check workflow logs for detailed error messages
- Review
hubcap.logartifact for application-specific errors - Verify target repository structure and accessibility
- Check workflow execution logs
- Review artifacts from failed runs
- Test with dry-run mode first
- Use test environment for debugging