Files
ljwx-deploy/scripts/github

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 with workspace-write + network_access=true
  • github_api.sh: call GitHub REST or GraphQL with explicit token auth, timeout, and retry
  • preflight.sh: verify DNS, token, rate limit, repository access, and Project V2 access before mutating GitHub state
  • issue-comment.sh: create an issue comment via direct REST API
  • project-v2-update.sh: add or update a Project V2 item via direct GraphQL API
  • _gh_env.sh: prepare GH_CONFIG_DIR and XDG_* directories in the workspace
  • _gh_retry.sh: retry gh CLI commands for transient network failures
  • config.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 } }"}'