github-context
GitHub Context Skill
Foundational skill for collecting GitHub issue and pull request context into a standardized, structured format.
Why Use This Skill?
Instead of running multiple gh commands manually, this skill provides:
- Structured Output: Consistent JSON format with all metadata in predictable locations
- Comprehensive Collection: Automatically gathers issues/PRs, comments, diffs, review threads, commits, and CI logs in one pass
- Configurable Scope: Fine-grained control over what to collect (diffs, checks, threads, etc.) via environment variables
- Manifest Generation: Produces
manifest.jsonwith collection metadata for downstream processing - Reusability: Can be invoked standalone or as a dependency by other skills
Environment and Paths
GITHUB_CONTEXT_DIR: Output directory for collected context- Default:
/holon/output/github-contextif the path exists; otherwise a temp dir/tmp/holon-ghctx-*
- Default:
MANIFEST_PROVIDER/COLLECT_PROVIDER: Provider name written tomanifest.json(default:github-context)TRIGGER_COMMENT_ID: Comment ID to flag withis_triggerin comments/review threadsINCLUDE_DIFF(default:true): Fetch PR diffINCLUDE_CHECKS(default:true): Fetch check runs and workflow logsINCLUDE_THREADS(default:true): Fetch review comment threadsINCLUDE_FILES(default:true): Fetch changed files listINCLUDE_COMMITS(default:true): Fetch commits for the PRMAX_FILES(default:200): Limit for files collected whenINCLUDE_FILES=true
Usage
Use the skill runner (Holon or host) to invoke scripts/collect.sh with the reference; examples assume the script is on PATH or referenced relative to the skill directory:
collect.sh "holon-run/holon#123"
collect.sh 123 holon-run/holon
INCLUDE_CHECKS=false MAX_FILES=50 collect.sh https://github.com/holon-run/holon/pull/123
Output Contract
Artifacts are written to ${GITHUB_CONTEXT_DIR}/github/:
issue.json(issues) orpr.json(PRs)comments.jsonreview_threads.json(whenINCLUDE_THREADS=trueand PR)files.json(whenINCLUDE_FILES=trueand PR)pr.diff(whenINCLUDE_DIFF=trueand PR)commits.json(whenINCLUDE_COMMITS=trueand PR)check_runs.jsonandtest-failure-logs.txt(whenINCLUDE_CHECKS=trueand PR)manifest.json(written at${GITHUB_CONTEXT_DIR}/manifest.json)
Integration Notes
- Wrapper skills set their own defaults and
MANIFEST_PROVIDERbefore delegating to this collector. - The helper library lives at
scripts/lib/helpers.shand provides parsing, dependency checks, fetching helpers, and manifest writing. Source it instead of copying.
Input Payload
When invoking this skill, you can provide a payload file with metadata:
/holon/input/payload.json(optional): Contains task metadata with GitHub reference{ "ref": "holon-run/holon#502", "repo": "holon-run/holon", "type": "issue|pr", "trigger_comment_id": 123456 }
The agent should extract the ref field from payload.json and pass it to the collection script. If payload.json doesn't exist or ref is not provided, check for:
- Command-line arguments or environment variables with the reference
- Fallback to requesting the reference from the user
Reference Formats
The collection script accepts GitHub references in multiple formats:
holon-run/holon#502- owner/repo#number format502- numeric (requires repo_hint as second argument)https://github.com/holon-run/holon/issues/502- full URL
Context Files
When collection completes, the following files are available under ${GITHUB_CONTEXT_DIR}/github/:
Issue Context Files
issue.json: Issue metadatacomments.json: Issue comments
PR Context Files
pr.json: Pull request metadata including reviews and statsfiles.json: Changed files list (capped byMAX_FILES)review_threads.json: Review threads with line-specific comments (includescomment_id)comments.json: PR discussion commentspr.diff: The code changes being reviewedcommits.json: PR commits (whenINCLUDE_COMMITS=true)check_runs.json: CI/check run metadata (whenINCLUDE_CHECKS=true)test-failure-logs.txt: Complete workflow logs for failed tests (whenINCLUDE_CHECKS=true)