| name | qtpass-github |
| description | QtPass GitHub interaction - PRs, issues, branches, merging |
| license | GPL-3.0-or-later |
| metadata | {"audience":"developers","workflow":"github"} |
QtPass GitHub Interaction
Checking PR Status
gh pr checks <PR_NUMBER>
gh pr view <PR_NUMBER> --json state,mergeable
gh api repos/IJHack/QtPass/pulls/<PR_NUMBER>/comments
Creating Branches
git checkout -b <branch-name>
git push -u origin <branch-name>
Creating PRs
gh pr create --title "Fix description (#issue)" --body "## Summary\n- Fix details\n\nFixes #issue"
gh pr create --base main --title "Fix" --body "Fixes #issue"
Updating Branches
Before pushing or merging, always update with latest main:
git remote add upstream https://github.com/IJHack/QtPass.git
git pull upstream main --rebase
git push --force-with-lease <push-remote> <branch>
This prevents "branch is out-of-date with base branch" errors.
Signed Commits
Always sign your commits with -S flag:
git commit -S -m "Fix description"
If a PR has unsigned commits (e.g., from bots), recreate the changes on a new branch with signed commits:
git fetch origin <branch>
git checkout FETCH_HEAD
git add -A
git commit -S -m "chore: description"
git push -u origin new-branch-name
Merging PRs
Preferred: Squash merge for long PR threads
Squash merging keeps the main branch history clean and avoids cluttering it with numerous intermediate commits from review iterations.
Squash merge now via GitHub CLI
When all CI checks pass and you want to merge immediately:
gh pr merge <PR_NUMBER> --squash --delete-branch --subject "fix: description"
Schedule squash merge (waits for CI)
When you want to wait for CI to pass before merging:
gh pr merge <PR_NUMBER> --squash --auto --delete-branch
Avoid force pushing to shared branches
Only force push to feature branches when absolutely necessary (e.g., resolving merge conflicts, cleaning up commits). Prefer --force-with-lease over -f because it fails if someone else pushed to the branch, preventing accidental overwrites of others' work. Never use -f or --force on main or shared branches:
git push --force-with-lease <push-remote> <branch>
git push --force origin main
Never force push to main or branches that others may be working from.
Merge strategies:
| Strategy | Use Case |
|---|
| Squash | Feature PRs with multiple review commits (preferred) |
| Merge | PRs where individual commits have meaningful history |
| Rebase | Clean, linear history (rarely used here) |
When to use merge (not squash):
- Hotfixes that need individual commits for rollback
- PRs with distinct, logically separate changes
gh pr merge <PR_NUMBER> --merge --auto --delete-branch
Commenting on Issues/PRs
gh issue comment <ISSUE_NUMBER> --body "Comment text"
gh pr comment <PR_NUMBER> --body "## Summary\n- Details"
Using HEREDOC for Multi-line Comments
For complex comments with Markdown formatting, HEREDOC avoids shell interpretation issues:
gh pr comment <PR_NUMBER> --body "$(cat <<'EOF'
## Changes in this PR
### .gitignore additions
- Added test binaries to prevent accidentally committing test executables
- Added *.bak for test settings backup files
### New skill: qtpass-github
A comprehensive skill for GitHub interaction workflows:
- Reading issues and PRs
- Responding to users
- CI debugging
EOF
)"
Key points:
- Use
$(cat <<'EOF' ... EOF) to capture the content
- Quote the
EOF delimiter ('EOF') to prevent variable expansion
- Use
\n for newlines in inline strings (less readable)
- Use HEREDOC for complex/long comments (more readable)
Reading Issues and PRs
gh issue view <ISSUE_NUMBER>
gh issue view <ISSUE_NUMBER> --comments
gh issue view <ISSUE_NUMBER> --json body
gh pr view <PR_NUMBER>
gh pr view <PR_NUMBER> --json comments
gh api repos/<owner>/<repo>/pulls/<PR_NUMBER>/comments
gh api repos/<owner>/<repo>/issues/<ISSUE_NUMBER>/comments
Answering User Questions
When responding to users on issues or PRs:
- Read the full context - Check previous comments and related issues
- Be clear and concise - Answer directly
- Provide next steps - Let user know what to expect
- Use Markdown - Format for readability
Example response templates:
## Investigation
I've looked into this issue. The root cause is...
## Fix
I've implemented a fix that...
## Next Steps
- Review the PR when ready
- Test on your machine
- Let me know if you have questions
Good Practices
- Always acknowledge user's report/feedback
- Explain technical details in simple terms
- Provide actionable next steps
- Follow up on unanswered questions
- Thank contributors for their input
Common Patterns
Pre-PR Checklist
npx prettier --write "**/*.md" "**/*.yml"
npx prettier --check "**/*.md"
git fetch upstream
git pull upstream main --rebase
git push
Post-Merge Cleanup
git checkout main
git pull upstream main
git branch -d <branch-name>
Debugging CI Failures
When CI checks fail on GitHub:
gh run view <RUN_ID>
gh run view <RUN_ID> --log
gh run view <RUN_ID> --log | grep -iE "error|fail"
gh run view <RUN_ID> --job <JOB_NAME> --log
Common CI Failures
| Failure | Likely Cause | Fix |
|---|
| Linting errors | Formatting issues | Run npx prettier --write |
| Test failures | Bug in code or test | Run tests locally with make check |
| Build failures | Missing deps or syntax | Build locally with make -j4 |
| act fails on new branches | HEAD~0 error | Skip act, rely on prettier check |
Resolving Merge Conflicts
When branch is behind main and has conflicts:
git checkout <branch>
git fetch upstream
git rebase upstream/main
git add <resolved-files>
git rebase --continue
git push --force-with-lease <push-remote> <branch>
Fork Workflow
If you don't have push access:
git remote add myfork git@github.com:<your-username>/QtPass.git
git push -u myfork <branch-name>
gh pr create --base upstream/main --head <your-username>:<branch-name>
Note: When working with forks, use myfork for pushing and upstream for syncing with main repository.
Troubleshooting
"Branch is out-of-date"
git checkout <branch-name>
git pull upstream main --rebase
git push --force-with-lease <push-remote> <branch-name>
Merge Failed
Check if:
- Branch is behind main → rebase and push
- CI still running → wait for checks
- Conflicts → resolve locally
Can't Merge PR
- Check branch protection rules
- Ensure all CI checks pass
- You may need admin rights to bypass some checks
Blocked by Unresolved Review Comments
When PR shows "All comments must be resolved" but you've fixed the issues:
1. Identify unresolved threads via GraphQL:
gh api graphql -f query='{ repository(owner: "<owner>", name: "<repo>") { pullRequest(number: <pr_number>) { id reviewThreads(first: 20) { nodes { id isResolved } } } } }' | jq -r '.data.repository.pullRequest.reviewThreads.nodes[] | "\(.id) \(.isResolved)"'
2. Resolve threads programmatically:
THREAD_ID="PRRT_FROM_STEP_1"
gh api graphql -f query="mutation { resolveReviewThread(input: {threadId: \"$THREAD_ID\"}) { thread { isResolved } } }"
3. Alternative: Submit a review to clear blocking comments:
gh api "repos/<owner>/<repo>/pulls/<pr_number>/reviews" -X POST -f "body"="All issues addressed in recent commits" -f "event"="COMMENT"
4. Common causes:
- Old CodeRabbit review comments not marked resolved
- Reviewer requested changes but didn't re-review after fixes
- Branch protection requires all conversations resolved
GitHub AI-Powered Bug Detection
GitHub provides AI-generated code quality suggestions under Security → AI findings.
Common AI Findings
- Tautology assertions - Tests that always pass
- Ignored return values - Test setup not verified
- Spelling corrections - Typos in comments/strings
- Formatting consistency - Backticks, spacing
- Contractions - "can't" vs "cannot"
- Copyright years - Use "YYYY" placeholder
Fixing AI Findings
-
Create a branch for fixes:
git checkout -b fix/ai-findings
-
Apply the suggested fixes
-
Test locally if possible
-
Push and create PR:
git push -u origin fix/ai-findings
cat <<'EOF' > /tmp/ai-findings-body.md
Found by GitHub AI-powered bug detection.
- Fixed tautology assertions in tests
- Added return value verification
- Corrected spelling typos
EOF
gh pr create --title "fix: resolve AI findings" --body-file /tmp/ai-findings-body.md
Checking AI Findings
gh api repos/<owner>/<repo>/code-scanning/alerts
Checking PR Status Before Merging
Before merging, always verify:
gh pr view <PR_NUMBER> --json state,mergeable
gh pr checks <PR_NUMBER>
gh pr view <PR_NUMBER> --json reviews
gh pr view <PR_NUMBER> --json baseRefName,headRefName
Pre-Merge Checklist
Before merging a PR:
act push -W .github/workflows/linter.yml -j build
git checkout <branch>
git pull upstream main --rebase
git push --force-with-lease <push-remote> <branch>