GitHub Webhook Setup
If you cannot create a GitHub App, you can use Pipelines as Code with GitHub webhooks on your repository. This method uses personal access tokens instead of GitHub App authentication.Limitations
To quickly restart CI without a meaningful change:Create GitHub Personal Access Token
After installing Pipelines as Code, create a personal access token for GitHub API operations.Fine-Grained Token (Recommended)
Fine-grained tokens provide better security by limiting permissions to specific repositories.Navigate to token settings
Go to GitHub Settings > Developer settings > Personal access tokens > Fine-grained tokensOr use this direct link: https://github.com/settings/tokens?type=beta
Create new token
Click Generate new token and configure:
- Token name:
pipelines-as-code-token - Expiration: 30 days (or your organization’s policy)
- Repository access: Select specific repositories
Set permissions
Configure the following repository permissions:
| Permission | Access |
|---|---|
| Administration | Read only |
| Metadata | Read only |
| Contents | Read only |
| Commit statuses | Read and Write |
| Pull requests | Read and Write |
| Webhooks | Read and Write |
Classic Token
Classic tokens have broader permissions but are simpler to configure.Navigate to token settings
Select scopes
For public repositories:
public_repo
repo(entire scope)
tkn pac CLI to configure webhook:- Add
admin:repo_hook
Create Repository and Configure Webhook
There are two methods to create the Repository CRD and configure the webhook:Automated Setup with tkn pac CLI
Run create repo command
- Git repository URL
- Target namespace
- GitHub personal access token (with
admin:repo_hookscope) - Webhook secret
Manual Setup
Create webhook in GitHub
- Go to your repository Settings > Webhooks
- Click Add webhook
- Configure:
- Payload URL: Your Pipelines as Code controller URL
- Content type:
application/json - Secret: Generate with
head -c 30 /dev/random | base64
- Select individual events:
- Commit comments
- Issue comments
- Pull requests
- Pushes
- Click Add webhook
Managing Webhooks
Add Webhook to Existing Repository
If you need to add a webhook to an existing Repository:Use
-n namespace flag if your Repository exists in a non-default namespace.Update Personal Access Token
When your token expires or needs rotation:Option 1: Using tkn pac CLI
Option 2: Using kubectl
Find the secret name in your Repository CRD:Important Notes
- Secrets must be in the same namespace as the Repository CRD
- Set up token expiration reminders to avoid service disruption
- For better security, use fine-grained tokens scoped to specific repositories
- Consider using GitHub Apps instead if you need the full feature set
Next Steps
After configuring GitHub webhook:- Add
.tektondirectory with pipeline definitions to your repository - Test by creating a pull request or pushing a commit
- Check pipeline status in PR comments