GitHub Integration
Automatically sync packages when you push to GitHub.
Setup Webhook
1. Get Webhook URL
Your webhook URL is:
https://packages.example.com/api/webhooks/github
2. Create Webhook in GitHub
- Go to your repository Settings > Webhooks
- Click Add webhook
- Configure:
- Payload URL: Your webhook URL
- Content type:
application/json - Secret: Generate a secure secret
- Events: Select "Just the push event" or specific events
3. Configure Cargoman
Set the webhook secret:
GITHUB_WEBHOOK_SECRET=your-webhook-secret
Supported Events
| Event | Action |
|---|---|
push | Sync affected packages |
create (tag) | Add new version |
delete (tag) | Remove version |
Organization Webhooks
For multiple repositories, use organization-level webhooks:
- Go to Organization Settings > Webhooks
- Add webhook with the same configuration
- All repositories will trigger syncs
GitHub App (Coming Soon)
For easier setup, we're building a GitHub App that:
- Automatically configures webhooks
- Provides repository selection UI
- Handles authentication securely
Troubleshooting
Webhook Not Triggering
Check webhook delivery logs in GitHub:
- Go to Settings > Webhooks
- Click your webhook
- View Recent Deliveries
Authentication Failed
Ensure your webhook secret matches:
# In Cargoman
GITHUB_WEBHOOK_SECRET=abc123
# In GitHub webhook settings
Secret: abc123
Package Not Syncing
Verify:
- Repository URL matches in Cargoman
- Tag format is valid (e.g.,
v1.0.0) composer.jsonexists in repository root
Private Repositories
For private repositories, configure Git authentication:
# Using personal access token
GIT_AUTH_TOKEN=ghp_xxxx
Or use SSH keys (self-hosted only):
# Add SSH key to ~/.ssh/id_rsa
# Ensure it has read access to repositories
Example Workflow
# .github/workflows/release.yml
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate composer.json
run: composer validate
# Webhook automatically syncs on tag push
# No additional steps needed!