@teambit/ci 1.0.632 → 1.0.634
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ci.docs.mdx +8 -0
- package/dist/ci.docs.mdx +8 -0
- package/dist/ci.main.runtime.js +5 -1
- package/dist/ci.main.runtime.js.map +1 -1
- package/dist/{preview-1792168769587.js → preview-1792418223123.js} +1 -1
- package/dist/source-branch-detector.d.ts +4 -2
- package/dist/source-branch-detector.js +44 -30
- package/dist/source-branch-detector.js.map +1 -1
- package/dist/source-branch-detector.spec.d.ts +1 -0
- package/dist/source-branch-detector.spec.js +141 -0
- package/dist/source-branch-detector.spec.js.map +1 -0
- package/dist/sync/git-host-provider.spec.js +28 -0
- package/dist/sync/git-host-provider.spec.js.map +1 -1
- package/dist/sync/github-client.d.ts +41 -5
- package/dist/sync/github-client.js +131 -20
- package/dist/sync/github-client.js.map +1 -1
- package/dist/sync/github-client.spec.js +351 -0
- package/dist/sync/github-client.spec.js.map +1 -1
- package/dist/sync/init-scaffold.d.ts +2 -0
- package/dist/sync/init-scaffold.js +7 -4
- package/dist/sync/init-scaffold.js.map +1 -1
- package/dist/sync/init-scaffold.spec.js +56 -10
- package/dist/sync/init-scaffold.spec.js.map +1 -1
- package/package.json +11 -11
- package/sync/git-host-provider.spec.ts +29 -0
- package/sync/github-client.spec.ts +334 -1
- package/sync/github-client.ts +130 -26
- package/sync/init-scaffold.spec.ts +62 -5
- package/sync/init-scaffold.ts +9 -4
package/ci.docs.mdx
CHANGED
|
@@ -467,6 +467,14 @@ For GitHub, the command reads **`BIT_GITHUB_TOKEN` before `GITHUB_TOKEN`**. GitH
|
|
|
467
467
|
`GITHUB_TOKEN` on every job, so an override needs the higher priority. The command reads the repository from
|
|
468
468
|
`GITHUB_REPOSITORY`. If that variable is absent, the command reads the `origin` remote.
|
|
469
469
|
|
|
470
|
+
On GitHub Enterprise Server, the command also claims an `origin` remote on the host that `GITHUB_SERVER_URL`
|
|
471
|
+
names, and sends the API requests for that host to `GITHUB_API_URL`. GitHub Actions sets both variables on
|
|
472
|
+
every job. Outside Actions, set `GITHUB_SERVER_URL` (for example `https://ghe.example.com`); without
|
|
473
|
+
`GITHUB_API_URL` the API defaults to `https://ghe.example.com/api/v3`. A `GITHUB_API_URL` must be on the server
|
|
474
|
+
host or on `api.<server host>` (GHE.com data residency), and must be `https` when the server is; any other
|
|
475
|
+
value is refused with a warning and the GitHub provider stays unconfigured, so the enterprise token is never
|
|
476
|
+
sent elsewhere. A github.com remote on such a runner still uses `https://api.github.com`.
|
|
477
|
+
|
|
470
478
|
---
|
|
471
479
|
|
|
472
480
|
## Configuration
|
package/dist/ci.docs.mdx
CHANGED
|
@@ -467,6 +467,14 @@ For GitHub, the command reads **`BIT_GITHUB_TOKEN` before `GITHUB_TOKEN`**. GitH
|
|
|
467
467
|
`GITHUB_TOKEN` on every job, so an override needs the higher priority. The command reads the repository from
|
|
468
468
|
`GITHUB_REPOSITORY`. If that variable is absent, the command reads the `origin` remote.
|
|
469
469
|
|
|
470
|
+
On GitHub Enterprise Server, the command also claims an `origin` remote on the host that `GITHUB_SERVER_URL`
|
|
471
|
+
names, and sends the API requests for that host to `GITHUB_API_URL`. GitHub Actions sets both variables on
|
|
472
|
+
every job. Outside Actions, set `GITHUB_SERVER_URL` (for example `https://ghe.example.com`); without
|
|
473
|
+
`GITHUB_API_URL` the API defaults to `https://ghe.example.com/api/v3`. A `GITHUB_API_URL` must be on the server
|
|
474
|
+
host or on `api.<server host>` (GHE.com data residency), and must be `https` when the server is; any other
|
|
475
|
+
value is refused with a warning and the GitHub provider stays unconfigured, so the enterprise token is never
|
|
476
|
+
sent elsewhere. A github.com remote on such a runner still uses `https://api.github.com`.
|
|
477
|
+
|
|
470
478
|
---
|
|
471
479
|
|
|
472
480
|
## Configuration
|
package/dist/ci.main.runtime.js
CHANGED
|
@@ -376,10 +376,14 @@ class CiMain {
|
|
|
376
376
|
if (!pullRequestUrl) return undefined;
|
|
377
377
|
try {
|
|
378
378
|
const {
|
|
379
|
+
hostname,
|
|
379
380
|
pathname
|
|
380
381
|
} = new URL(pullRequestUrl);
|
|
381
382
|
const [, owner, repo, pullSegment, pullNumber] = pathname.split('/');
|
|
382
383
|
if (!owner || !repo || pullSegment !== 'pull' || !pullNumber) return undefined;
|
|
384
|
+
// an enterprise API the environment can't vouch for gets no token, and no request
|
|
385
|
+
const api = (0, _githubClient().gitHubApiUrl)(hostname);
|
|
386
|
+
if ('error' in api) return undefined;
|
|
383
387
|
const headers = {
|
|
384
388
|
Accept: 'application/vnd.github+json',
|
|
385
389
|
'X-GitHub-Api-Version': '2022-11-28'
|
|
@@ -388,7 +392,7 @@ class CiMain {
|
|
|
388
392
|
const controller = new AbortController();
|
|
389
393
|
const timeout = setTimeout(() => controller.abort(), 5_000);
|
|
390
394
|
try {
|
|
391
|
-
const response = await fetch(
|
|
395
|
+
const response = await fetch(`${api.url}/repos/${owner}/${repo}/pulls/${pullNumber}`, {
|
|
392
396
|
headers,
|
|
393
397
|
signal: controller.signal
|
|
394
398
|
});
|