GitHub Sandbox Helpers
These scripts keep GitHub CLI and API state inside the current workspace instead of relying on a user home directory or system keychain.
Files
cxgh: launch Codex withworkspace-write+network_access=truegithub_api.sh: call GitHub REST or GraphQL with explicit token auth, timeout, and retrypreflight.sh: verify DNS, token, rate limit, repository access, and Project V2 access before mutating GitHub stateissue-comment.sh: create an issue comment via direct REST APIproject-v2-update.sh: add or update a Project V2 item via direct GraphQL API_gh_env.sh: prepareGH_CONFIG_DIRandXDG_*directories in the workspace_gh_retry.sh: retryghCLI commands for transient network failuresconfig.toml.example: minimal Codex config for GitHub-heavy sessions
Quick Start
export GH_TOKEN="<token>"
bash scripts/github/cxgh "查看当前 repo 的 open issues,并给 #150 添加进展评论"
Preflight:
export GH_TOKEN="<token>"
bash scripts/github/preflight.sh \
--repo BrunoGaoSZ/ljwx-deploy \
--project-url 'https://github.com/orgs/BrunoGaoSZ/projects/3/views/1'
Direct API Example
export GH_TOKEN="<token>"
bash scripts/github/github_api.sh repos/BrunoGaoSZ/ljwx-deploy/issues/150
Issue comment:
export GH_TOKEN="<token>"
bash scripts/github/issue-comment.sh \
--repo BrunoGaoSZ/ljwx-deploy \
--issue 150 \
--body 'Progress update'
Project update:
export GH_TOKEN="<token>"
bash scripts/github/project-v2-update.sh \
--project-url 'https://github.com/orgs/BrunoGaoSZ/projects/3/views/1' \
--content-url 'https://github.com/BrunoGaoSZ/ljwx-deploy/issues/150' \
--field-name 'Status' \
--single-select 'In progress'
GraphQL:
export GH_TOKEN="<token>"
bash scripts/github/github_api.sh \
--graphql \
--data '{"query":"query { viewer { login } }"}'