| name | github-workflow |
| description | GitHub workflow conventions for the Terraform provider. Covers using the gh CLI, creating PRs, extracting CI errors, and fetching review comments. |
GitHub Workflow
Always Use gh CLI
When interacting with GitHub — PRs, issues, CI/CD runs — always use the gh CLI. Do NOT use read_url_content to scrape GitHub pages.
gh pr view 42 --repo doitintl/terraform-provider-doit
gh pr diff 42 --repo doitintl/terraform-provider-doit
gh run view <RUN_ID> --repo doitintl/terraform-provider-doit
gh run view <RUN_ID> --repo doitintl/terraform-provider-doit --log-failed
gh issue view 42 --repo doitintl/terraform-provider-doit
Extracting CI Errors
The --log-failed output is verbose. Use these grep patterns:
gh run view <RUN_ID> --repo <REPO> --log-failed 2>&1 | grep "^Run Tests.*FAIL" | head -20
gh run view <RUN_ID> --repo <REPO> --log-failed 2>&1 | \
grep -E "(inconsistent|was cty\.|but now|null fallback|non-retryable)" | head -20
gh run view <RUN_ID> --repo <REPO> --log-failed 2>&1 | \
grep -E "TestAccMyTest" -B 5 -A 15 | head -50
Fetching PR Review Comments
gh api repos/<OWNER>/<REPO>/pulls/<PR>/reviews --jq '.[] | "\(.id) \(.user.login) \(.state)"'
gh api repos/<OWNER>/<REPO>/pulls/<PR>/reviews/<REVIEW_ID>/comments \
--jq '.[] | "--- \(.path):\(.original_line // .line) ---\n\(.body)\n"'
REVIEW_ID=$(gh api repos/<OWNER>/<REPO>/pulls/<PR>/reviews --jq '.[] | select(.user.login | test("copilot|bot")) | .id') && \
gh api repos/<OWNER>/<REPO>/pulls/<PR>/reviews/${REVIEW_ID}/comments \
--jq '.[] | "--- \(.path):\(.original_line // .line) ---\n\(.body)\n"'
.gitignore Check
Always check .gitignore before committing:
git check-ignore -v path/to/file
Some files (like OpenAPI/api_endpoint_analysis.md, OpenAPI/issues/) are local documentation and should NOT be committed.
Commit Hygiene
- Never use
--no-verify — pre-commit hooks exist for a reason. If a hook fails, fix the issue before committing.
- Never force-push (
--force or --force-with-lease) unless the user explicitly requests it.
- Prefer small, focused commits over amending previous ones.