Troubleshooting¶
Common Issues¶
No Repositories Found¶
Symptom: Discovery returns 0 repositories
Checks:
- Verify team slug is correct
- Confirm Core App has "Members" organization permission
- Check
ownerparameter in token generation
# Debug: Test team query directly
gh api graphql -f query='
{
organization(login: "your-org") {
team(slug: "target-team") {
name
repositories(first: 5) {
totalCount
nodes { name }
}
}
}
}'
PRs Not Created¶
Symptom: Workflow completes but no PRs appear
Checks:
- Verify files actually changed
- Check change detection logic
- Review workflow logs for error messages
# Add debug output
- name: Debug changes
working-directory: target
run: |
echo "Git status:"
git status
echo "Git diff:"
git diff
New Files Not Detected¶
Symptom: Distribution reports "No changes needed" for repos missing the file
Root Cause: Using git diff --quiet instead of git status --porcelain
git diff only detects modifications to tracked files. When distributing a file
to a repository that doesn't have it yet, the file is untracked and invisible
to git diff.
Solution: Use git status --porcelain for change detection:
# Wrong - misses untracked files
if git diff --quiet; then
echo "No changes"
fi
# Correct - detects all changes including new files
if [ -z "$(git status --porcelain)" ]; then
echo "No changes"
fi
See Change Detection for the full pattern.
Permission Denied¶
Symptom: 403 Forbidden errors
Checks:
- Verify Core App has required permissions
- Confirm app installed on target repositories
- Check workflow permissions declaration
Rate Limiting¶
Symptom: 403 Rate limit exceeded errors
Solution:
- Reduce
max-parallelvalue - Add rate limit checking
- Implement exponential backoff
Branch Conflicts¶
Symptom: Push fails with "non-fast-forward" error
Solution: Ensure branch preparation script uses force reset:
Clone Failures¶
Symptom: Repository not found errors
Checks:
- Verify repository exists
- Confirm Core App installed on repository
- Check repository visibility settings
Debug Workflow¶
name: Debug File Distribution
on:
workflow_dispatch:
jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: auth
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.CORE_APP_ID }}
private-key: ${{ secrets.CORE_APP_PRIVATE_KEY }}
owner: your-org
- name: Test token
env:
GH_TOKEN: ${{ steps.auth.outputs.token }}
run: |
echo "=== Rate Limits ==="
gh api /rate_limit --jq '.resources.core'
echo "=== Org Access ==="
gh api /orgs/your-org --jq '{name, login}'
echo "=== Team Query ==="
gh api graphql -f query='
{
organization(login: "your-org") {
teams(first: 5) {
nodes { name, slug }
}
}
}' --jq '.data.organization.teams'
echo "=== App Installation ==="
gh api /orgs/your-org/installations --jq '.installations[] | {id, app_slug}'
Error Reference¶
| Error | Cause | Solution |
|---|---|---|
404 Not Found |
Repo doesn't exist or no access | Check installation scope |
403 Forbidden |
Insufficient permissions | Review app permissions |
422 Unprocessable |
Invalid PR parameters | Check base/head branch names |
409 Conflict |
Branch already exists differently | Use force reset in script |
502 Bad Gateway |
GitHub temporary issue | Retry with backoff |