Commit c160a68
authored
Add optional
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
```yaml
# workflow usage
- uses: github/accessibility-scanner@v2
with:
token: ${{ secrets.GH_TOKEN }}
base_url: https://ghe.example.com/api/v3
```
```ts
const baseUrl = core.getInput('base_url', {required: false}) || undefined
const octokit = new OctokitWithThrottling({
auth: token,
baseUrl,
throttle: { ... },
})
```
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 Send tasks to Copilot coding agent from
[Slack](https://gh.io/cca-slack-docs) and
[Teams](https://gh.io/cca-teams-docs) to turn conversations into code.
Copilot posts an update in your thread when it's finished.base_url input to support GitHub Enterprise Octokit endpoints (#176)File tree
6 files changed
+19
-0
lines changed- .github/actions
- file
- src
- fix
- src
6 files changed
+19
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
| 124 | + | |
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
| |||
137 | 141 | | |
138 | 142 | | |
139 | 143 | | |
| 144 | + | |
140 | 145 | | |
141 | 146 | | |
142 | 147 | | |
| |||
0 commit comments