Skip to content

Add GHES support via -g and -p flags#3

Open
adjn wants to merge 8 commits into
BagToad:mainfrom
adjn:ghes-support
Open

Add GHES support via -g and -p flags#3
adjn wants to merge 8 commits into
BagToad:mainfrom
adjn:ghes-support

Conversation

@adjn

@adjn adjn commented Apr 10, 2026

Copy link
Copy Markdown
Collaborator

Adds two new flags to support pointing ARC at a GitHub Enterprise Server instance:

  • -g <config-url> — Full ARC githubConfigUrl for GHES (e.g. https://ghes.example.com/org/repo)
  • -p <token> — PAT for authenticating ARC against GHES (or set GHES_PAT env var)

Default behavior is unchanged

When neither flag is provided, everything works exactly as before — ARC targets the dotcom repo created by the extension, using the current gh auth token.

GHES usage

# Via env var (preferred)
export GHES_PAT=ghp_your_ghes_pat
gh mini-arc -g https://ghes.example.com/my-org/my-repo -s arc-runner-set

# Or via flag
gh mini-arc \
  -g https://ghes.example.com/my-org/my-repo \
  -p ghp_your_ghes_pat \
  -s arc-runner-set

The Codespace still runs on dotcom — only the ARC runner registration targets GHES.

Changes

  • gh-mini-arc: Added -g and -p flags, validation (-g requires a PAT, -p requires -g), explicit if/else to resolve token and config URL based on GHES mode, GH_HOST=github.com to ensure dotcom targeting, token piped via stdin
  • README.md: Added GHES Support section, consolidated Options table, added dotcom auth prerequisite

Add two new flags to support pointing ARC at a GitHub Enterprise Server
instance:

  -g <config-url>  Full ARC githubConfigUrl for GHES
  -p <token>       PAT for authenticating ARC against GHES

When neither flag is provided, behavior is unchanged — ARC targets
the dotcom repo created by the extension. When -g is used, -p is
required (validated at startup).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds optional GitHub Enterprise Server (GHES) targeting for the Actions Runner Controller (ARC) configuration while keeping the extension’s existing “create dotcom repo + Codespace + install ARC” flow as the default.

Changes:

  • Added -g <config-url> and -p <token> flags to parameterize ARC’s githubConfigUrl and auth token.
  • Added validation requiring -p when -g is specified.
  • Documented GHES usage and consolidated options in the README.
Show a summary per file
File Description
README.md Documents GHES targeting and updates the options table.
gh-mini-arc Adds CLI flags + validation and uses resolved token/config URL when setting Codespaces secrets.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

Comment thread gh-mini-arc
Comment thread README.md Outdated
Comment thread README.md Outdated

@adjn adjn left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds GitHub Enterprise Server (GHES) support to the gh mini-arc extension by allowing users to provide an ARC githubConfigUrl and authentication token, while still creating/running the Codespace on GitHub.com.

Changes:

  • Added -g (GHES config URL) and -p (PAT) flags to gh-mini-arc, plus validation and parameterized secret values.
  • Updated README with a GHES usage section and a consolidated options table.
Show a summary per file
File Description
README.md Documents GHES usage and adds -g/-p to the options table.
gh-mini-arc Parses -g/-p, validates pairing, and sets ARC token/config URL secrets based on GHES inputs.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (2)

gh-mini-arc:58

  • The -g/-p pairing check is using GHES_PAT/GHES_CONFIG_URL directly, so exporting GHES_PAT (as suggested in the README) and then running gh mini-arc without -g will fail with the "must be used together" error. To keep default behavior unchanged, consider validating only CLI-provided flags (or gating the check behind -g), and ignore GHES_PAT unless GHES mode is enabled.
# -g and -p must be used together
if [ -n "${GHES_CONFIG_URL}" ] && [ -z "${GHES_PAT}" ] || [ -z "${GHES_CONFIG_URL}" ] && [ -n "${GHES_PAT}" ]; then
  echo "Error: -g <config-url> and -p <token> must be used together" >&2
  exit 1
fi

gh-mini-arc:76

  • ARC_TOKEN/ARC_CONFIG_URL currently prefer GHES_PAT/GHES_CONFIG_URL even when -g isn’t provided. This means simply having those env vars set changes the "no flags" path (and can make the script use a GHES PAT against dotcom). If the intent is "GHES only when -g is specified", gate the env var fallback behind GHES_CONFIG_URL (or another explicit GHES-mode flag) so the default path always uses gh auth token + the dotcom repo URL.
# Resolve the ARC token and config URL — use GHES values if provided, otherwise default to dotcom
ARC_TOKEN="${GHES_PAT:-$(gh auth token)}"
ARC_CONFIG_URL="${GHES_CONFIG_URL:-https://github.com/${REPO_OWNER}/${REPO_NAME}}"

gh secret set FAST_ARC_TOKEN -a codespaces --repo ${REPO_OWNER}/${REPO_NAME} --body "${ARC_TOKEN}"
  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread README.md Outdated
Comment thread gh-mini-arc
- Require -g and -p together (reject either flag without the other)
- Document GHES_PAT env var as preferred alternative to -p flag
- Add prerequisite note that gh must be authenticated to github.com

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GitHub Enterprise Server (GHES) targeting support to the gh mini-arc extension by allowing the ARC runner registration configuration (token + githubConfigUrl) to be overridden while still creating/running the Codespace on GitHub.com.

Changes:

  • Added -g (GHES githubConfigUrl) and -p (GHES PAT) flags with basic validation in gh-mini-arc.
  • Parameterized the ARC token/config URL secrets to use GHES values when provided, otherwise default to dotcom behavior.
  • Updated README with GHES usage instructions and an options table including the new flags.
Show a summary per file
File Description
gh-mini-arc Adds -g/-p flags, validates flag combinations, and sets ARC secrets from either GHES inputs or dotcom defaults.
README.md Documents GHES usage and lists the new CLI options.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 4

Comment thread gh-mini-arc Outdated
Comment thread gh-mini-arc
Comment thread README.md
Comment thread README.md Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adjn

adjn commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator Author

/review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GitHub Enterprise Server (GHES) targeting support to the gh mini-arc extension so ARC can register runners against GHES while the Codespace/repo lifecycle remains on GitHub.com.

Changes:

  • Added -g <config-url> and -p <token> flags to gh-mini-arc, including basic validation and wiring into FAST_ARC_TOKEN / ARC_CONFIG_URL secrets.
  • Documented GHES usage and consolidated/expanded the options table in README.md.
Show a summary per file
File Description
gh-mini-arc Adds CLI flags and logic to set ARC token/config URL based on GHES inputs.
README.md Documents GHES mode and updates options/usage guidance.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 5

Comment thread gh-mini-arc
Comment thread gh-mini-arc
Comment thread gh-mini-arc
Comment thread gh-mini-arc Outdated
Comment thread README.md Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Export GH_HOST=github.com so gh commands always target dotcom
- Pipe ARC token via stdin to avoid exposure in process args

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GitHub Enterprise Server (GHES) targeting support to the gh mini-arc extension while keeping the default dotcom behavior unchanged (Codespace + repo creation still happens on github.com; only ARC registration can be pointed at GHES).

Changes:

  • Added -g (GHES githubConfigUrl) and -p (GHES PAT) flags with validation in gh-mini-arc.
  • Parameterized ARC token/config URL selection based on whether -g is provided.
  • Updated README with GHES usage guidance and an updated Options table.
Show a summary per file
File Description
README.md Documents GHES workflow/flags and consolidates Options.
gh-mini-arc Implements -g/-p parsing + validation, forces GH_HOST=github.com, and switches ARC token/config URL selection logic.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

Comment thread gh-mini-arc
Comment thread gh-mini-arc Outdated
Comment thread gh-mini-arc
adjn and others added 2 commits April 10, 2026 19:38
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for configuring Actions Runner Controller (ARC) against a GitHub Enterprise Server (GHES) instance while still creating the Codespace/repository on GitHub.com, by introducing new CLI flags and documenting GHES usage.

Changes:

  • Added -g (GHES ARC config URL) and -p (GHES PAT) flags to gh-mini-arc, with validation and conditional secret/config URL wiring.
  • Forced gh CLI calls in the script to target github.com via GH_HOST to keep Codespaces/repo creation on dotcom.
  • Updated README.md with a GHES Support section and consolidated options table.
Show a summary per file
File Description
README.md Documents GHES usage and adds -g / -p to the options list.
gh-mini-arc Implements new flags, validates combinations, and parameterizes ARC secrets/config URL for GHES vs dotcom.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread gh-mini-arc
Comment thread gh-mini-arc
Comment on lines 9 to +13
REPO_NAME="fast-arc-$(date +%s)"
GHES_CONFIG_URL=""
GHES_PAT_FLAG=false

while getopts ":s:t:n:h" opt; do
while getopts ":s:t:n:g:p:h" opt; do

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds optional GitHub Enterprise Server (GHES) targeting for ARC runner registration while keeping Codespaces/repo creation on GitHub.com.

Changes:

  • Added -g (GHES githubConfigUrl) and -p (GHES PAT / GHES_PAT) flags with basic cross-flag validation.
  • Forced gh commands to target github.com via GH_HOST=github.com, and switched secret setting to pipe token via stdin.
  • Updated README with GHES usage guidance and consolidated options.
Show a summary per file
File Description
gh-mini-arc Adds GHES flags, resolves token/config URL based on GHES mode, and ensures dotcom targeting for gh commands.
README.md Documents GHES mode, prerequisites, and flags/options.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

Comment thread gh-mini-arc
@@ -20,13 +25,25 @@ while getopts ":s:t:n:h" opt; do
TEMPLATE_REPO="$(echo $OPTARG | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd '[:alnum:]-' | cut -c 1-100)"
Comment thread gh-mini-arc
Comment on lines +4 to 8
# All gh commands target dotcom (repo/codespace creation requires github.com)
export GH_HOST=github.com

REPO_OWNER="$(gh api user --jq '.login')"
TEMPLATE_REPO="BagToad/mini-arc-template"
Comment thread gh-mini-arc
Comment on lines +93 to 96
printf '%s' "${ARC_TOKEN}" | gh secret set FAST_ARC_TOKEN -a codespaces --repo ${REPO_OWNER}/${REPO_NAME}
if [ $? -ne 0 ]; then
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants