Skip to content

Add optional base_url input to support GitHub Enterprise Octokit endpoints#176

Open
Copilot wants to merge 7 commits intomainfrom
copilot/add-baseurl-configuration-option
Open

Add optional base_url input to support GitHub Enterprise Octokit endpoints#176
Copilot wants to merge 7 commits intomainfrom
copilot/add-baseurl-configuration-option

Conversation

Copy link
Contributor

Copilot AI commented Mar 25, 2026

Octokit currently defaults to https://api.github.com, which breaks API calls against GitHub Enterprise Server unless baseUrl is set explicitly.
This PR introduces an action-level configuration for API base URL and threads it through the sub-actions that instantiate Octokit.

  • New action input

    • Added optional base_url to root action.yml.
    • Intended format for GHE: https://HOSTNAME/api/v3.
  • Input propagation through composite action

    • Forwarded inputs.base_url from the root action into:
      • .github/actions/file
      • .github/actions/fix
  • Octokit configuration updates

    • In file/src/index.ts and fix/src/index.ts, read base_url via core.getInput('base_url', {required: false}).
    • Pass baseUrl into new OctokitWithThrottling({...}).
    • Keep existing behavior unchanged when base_url is omitted.
  • Docs update

    • Added base_url to README action input table and workflow example.
  • Focused coverage

    • Added unit tests for both file and fix action entrypoints to assert:
      • explicit base_url is passed as Octokit baseUrl
      • omitted base_url leaves Octokit on default API base URL behavior
# workflow usage
- uses: github/accessibility-scanner@v2
  with:
    token: ${{ secrets.GH_TOKEN }}
    base_url: https://ghe.example.com/api/v3
const baseUrl = core.getInput('base_url', {required: false}) || undefined

const octokit = new OctokitWithThrottling({
  auth: token,
  baseUrl,
  throttle: { ... },
})

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI linked an issue Mar 25, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add configuration option for Octokit baseUrl in action.yml Add optional base_url input to support GitHub Enterprise Octokit endpoints Mar 25, 2026
Copilot AI requested a review from JoyceZhu March 25, 2026 20:49
description: "Personal access token (PAT) with fine-grained permissions 'contents: write', 'issues: write', and 'pull_requests: write'"
required: true
base_url:
description: "Optional base URL for the GitHub API (for example, 'https://HOSTNAME/api/v3' for GitHub Enterprise Server)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description: "Optional base URL for the GitHub API (for example, 'https://HOSTNAME/api/v3' for GitHub Enterprise Server)"
description: "Optional base URL to pass into Octokit for the GitHub API (for example, `https://YOUR_HOSTNAME/api/v3` for GitHub Enterprise Server)"

@JoyceZhu JoyceZhu marked this pull request as ready for review March 25, 2026 21:38
@JoyceZhu JoyceZhu requested a review from a team as a code owner March 25, 2026 21:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new optional base_url input to the top-level composite action and wires it through to the file and fix sub-actions so Octokit can target GitHub Enterprise Server (or other non-default GitHub API endpoints).

Changes:

  • Added optional base_url input to the root action.yml and forwarded it into the file and fix steps.
  • Added base_url inputs to .github/actions/file and .github/actions/fix action metadata and passed the value into Octokit construction in both entrypoints.
  • Documented the new input in the root README.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
action.yml Defines base_url input and forwards it to file/fix sub-actions in the composite workflow.
README.md Documents base_url in the usage example and inputs table.
.github/actions/file/action.yml Declares base_url as an optional input for the file action.
.github/actions/file/src/index.ts Reads base_url and passes it as Octokit baseUrl.
.github/actions/fix/action.yml Declares base_url as an optional input for the fix action.
.github/actions/fix/src/index.ts Reads base_url and passes it as Octokit baseUrl.

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


const octokit = new OctokitWithThrottling({
auth: token,
baseUrl,
Copy link
Member

Choose a reason for hiding this comment

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

Do we need the key here, even just to be consistent? (I am also overthinking the quotes oops)

Suggested change
baseUrl,
"baseUrl": baseUrl,

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.

Doesn't work with GHE (enterprise)

4 participants