@teambit/ci 1.0.632 → 1.0.633

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.
@@ -451,4 +451,355 @@ describe('GitHubClient', () => {
451
451
  });
452
452
  });
453
453
 
454
+ /**
455
+ * GitHub Enterprise Server: Actions sets `GITHUB_SERVER_URL` and `GITHUB_API_URL` on every runner, and
456
+ * those two variables are all that turns a GHES remote into a GitHub one. On github.com Actions sets them
457
+ * to github.com's own values, which must read exactly like leaving them unset.
458
+ */
459
+ describe('GitHub Enterprise Server', () => {
460
+ const GHES_SERVER = 'https://ghe.corp.example';
461
+ const GHES_API = 'https://ghe.corp.example/api/v3';
462
+ const envKeys = ['GITHUB_TOKEN', 'BIT_GITHUB_TOKEN', 'GITHUB_REPOSITORY', 'GITHUB_API_URL', 'GITHUB_SERVER_URL'];
463
+ const saved = {};
464
+ beforeEach(() => {
465
+ envKeys.forEach(key => {
466
+ saved[key] = process.env[key];
467
+ delete process.env[key];
468
+ });
469
+ process.env.GITHUB_TOKEN = 'tok';
470
+ });
471
+ afterEach(() => {
472
+ envKeys.forEach(key => {
473
+ if (saved[key] === undefined) delete process.env[key];else process.env[key] = saved[key];
474
+ });
475
+ });
476
+
477
+ /** Records every request a client built from the environment makes, answering with `body`. */
478
+ function recordingFetch(body = []) {
479
+ const calls = [];
480
+ const fetchImpl = async (url, init) => {
481
+ calls.push({
482
+ url: String(url),
483
+ init
484
+ });
485
+ return new Response(JSON.stringify(body), {
486
+ status: 200,
487
+ headers: {
488
+ 'content-type': 'application/json'
489
+ }
490
+ });
491
+ };
492
+ return {
493
+ calls,
494
+ fetchImpl
495
+ };
496
+ }
497
+ const PR = {
498
+ number: 7,
499
+ state: 'open',
500
+ labels: [],
501
+ head: {
502
+ ref: 'lane-x'
503
+ },
504
+ html_url: 'http://pr/7'
505
+ };
506
+ describe('with neither variable set, or both naming github.com', () => {
507
+ const GITHUB_DOT_COM_ENVS = [['unset', {}], ['set by a github.com runner', {
508
+ GITHUB_API_URL: 'https://api.github.com',
509
+ GITHUB_SERVER_URL: 'https://github.com'
510
+ }]];
511
+ GITHUB_DOT_COM_ENVS.forEach(([name, env]) => {
512
+ it(`talks to api.github.com and claims github.com remotes only (${name})`, async () => {
513
+ Object.assign(process.env, env);
514
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)()).to.deep.equal({
515
+ url: 'https://api.github.com'
516
+ });
517
+ REMOTES.forEach(([url, repo, isGitHub]) => {
518
+ (0, _chai().expect)((0, _githubClient().parseGitHubRepo)(url), url).to.equal(repo);
519
+ (0, _chai().expect)((0, _githubClient().isGitHubRemote)(url), url).to.equal(isGitHub);
520
+ });
521
+ (0, _chai().expect)((0, _githubClient().isGitHubRemote)('https://ghe.corp.example/acme/store.git')).to.equal(false);
522
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv('https://ghe.corp.example/acme/store.git')).to.equal(undefined);
523
+ const client = _githubClient().GitHubClient.fromEnv('git@github.com:acme/shop.git');
524
+ (0, _chai().expect)(client?.apiUrl).to.equal('https://api.github.com');
525
+ const {
526
+ calls,
527
+ fetchImpl
528
+ } = recordingFetch(PR);
529
+ await new (_githubClient().GitHubClient)({
530
+ token: 'tok',
531
+ repo: client.repo,
532
+ apiUrl: client.apiUrl,
533
+ fetchImpl
534
+ }).createPr({
535
+ head: 'lane-x',
536
+ base: 'main',
537
+ title: 't',
538
+ body: 'b'
539
+ });
540
+ (0, _chai().expect)(calls[0].url).to.equal('https://api.github.com/repos/acme/shop/pulls');
541
+ });
542
+ });
543
+ });
544
+ it('a github.com repository always talks to api.github.com, whatever GITHUB_API_URL says', () => {
545
+ process.env.GITHUB_API_URL = 'https://evil.example/api/v3';
546
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)()).to.deep.equal({
547
+ url: 'https://api.github.com'
548
+ });
549
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('github.com')).to.deep.equal({
550
+ url: 'https://api.github.com'
551
+ });
552
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv('git@github.com:acme/shop.git')?.apiUrl).to.equal('https://api.github.com');
553
+ });
554
+ describe('on a GHES runner', () => {
555
+ beforeEach(() => {
556
+ process.env.GITHUB_API_URL = GHES_API;
557
+ process.env.GITHUB_SERVER_URL = GHES_SERVER;
558
+ });
559
+
560
+ /** url, parseGitHubRepo, isGitHubRemote — the GHES host joins github.com, and nothing else does. */
561
+ const GHES_REMOTES = [['https://ghe.corp.example/acme/store.git', 'acme/store', true], ['https://ghe.corp.example/acme/store', 'acme/store', true], ['git@ghe.corp.example:acme/store.git', 'acme/store', true], ['ssh://git@ghe.corp.example/acme/store.git', 'acme/store', true], ['https://x-access-token:tok@GHE.corp.example:443/acme/store.git', 'acme/store', true],
562
+ // github.com stays GitHub's on a GHES runner
563
+ ['git@github.com:acme/shop.git', 'acme/shop', true],
564
+ // the GHES host as a path segment, as a prefix of another host, or as userinfo is a look-alike
565
+ ['https://evil.example/ghe.corp.example/x.git', undefined, false], ['https://ghe.corp.example.evil.com/x.git', undefined, false], ['git@evil.example:ghe.corp.example/x.git', undefined, false], ['https://ghe.corp.example@evil.example/acme/store.git', undefined, false], ['https://corp.example/acme/store.git', undefined, false]];
566
+ it('claims and parses GHES remotes, and still rejects every look-alike', () => {
567
+ GHES_REMOTES.forEach(([url, repo, isGitHub]) => {
568
+ (0, _chai().expect)((0, _githubClient().parseGitHubRepo)(url), url).to.equal(repo);
569
+ (0, _chai().expect)((0, _githubClient().isGitHubRemote)(url), url).to.equal(isGitHub);
570
+ });
571
+ // the REMOTES table's verdicts hold unchanged alongside the GHES host
572
+ REMOTES.forEach(([url, repo, isGitHub]) => {
573
+ (0, _chai().expect)((0, _githubClient().parseGitHubRepo)(url), url).to.equal(repo);
574
+ (0, _chai().expect)((0, _githubClient().isGitHubRemote)(url), url).to.equal(isGitHub);
575
+ });
576
+ });
577
+ it('matchesRemote accepts the GHES remote in both url forms, and rejects look-alikes', () => {
578
+ const client = new (_githubClient().GitHubClient)({
579
+ token: 'tok',
580
+ repo: 'acme/store'
581
+ });
582
+ (0, _chai().expect)(client.matchesRemote('https://ghe.corp.example/acme/store.git')).to.equal(true);
583
+ (0, _chai().expect)(client.matchesRemote('git@ghe.corp.example:acme/store.git')).to.equal(true);
584
+ (0, _chai().expect)(client.matchesRemote('https://evil.example/ghe.corp.example/x.git')).to.equal(false);
585
+ (0, _chai().expect)(client.matchesRemote('https://ghe.corp.example.evil.com/x.git')).to.equal(false);
586
+ });
587
+ it('sends every pull-request call to the GHES API base', async () => {
588
+ const client = _githubClient().GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git');
589
+ (0, _chai().expect)(client?.repo).to.equal('acme/store');
590
+ (0, _chai().expect)(client?.apiUrl).to.equal(GHES_API);
591
+ const {
592
+ calls,
593
+ fetchImpl
594
+ } = recordingFetch(PR);
595
+ const wired = new (_githubClient().GitHubClient)({
596
+ token: 'tok',
597
+ repo: client.repo,
598
+ apiUrl: client.apiUrl,
599
+ fetchImpl
600
+ });
601
+ await wired.findPrByBranch('lane-x');
602
+ await wired.createPr({
603
+ head: 'lane-x',
604
+ base: 'main',
605
+ title: 't',
606
+ body: 'b'
607
+ });
608
+ await wired.addLabel(7, 'bit-sync-conflict');
609
+ await wired.closePr(7, 'bye');
610
+ (0, _chai().expect)(calls.map(c => `${c.init.method} ${c.url}`)).to.deep.equal(['GET https://ghe.corp.example/api/v3/repos/acme/store/pulls?state=open&head=acme%3Alane-x', 'POST https://ghe.corp.example/api/v3/repos/acme/store/pulls', 'POST https://ghe.corp.example/api/v3/repos/acme/store/issues/7/labels', 'POST https://ghe.corp.example/api/v3/repos/acme/store/issues/7/comments', 'PATCH https://ghe.corp.example/api/v3/repos/acme/store/pulls/7']);
611
+ });
612
+ it('uses the client built from the environment, with no fetch override, against the GHES base', async () => {
613
+ const realFetch = globalThis.fetch;
614
+ const {
615
+ calls,
616
+ fetchImpl
617
+ } = recordingFetch();
618
+ globalThis.fetch = fetchImpl;
619
+ try {
620
+ await _githubClient().GitHubClient.fromEnv('https://ghe.corp.example/acme/store.git')?.findPrByBranch('lane-x');
621
+ } finally {
622
+ globalThis.fetch = realFetch;
623
+ }
624
+ (0, _chai().expect)(calls).to.have.lengthOf(1);
625
+ (0, _chai().expect)(calls[0].url).to.match(/^https:\/\/ghe\.corp\.example\/api\/v3\/repos\/acme\/store\/pulls\?/);
626
+ (0, _chai().expect)(calls[0].init.headers.authorization).to.equal('Bearer tok');
627
+ });
628
+ it('a github.com remote on a GHES runner still talks to api.github.com', () => {
629
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv('git@github.com:acme/shop.git')?.apiUrl).to.equal('https://api.github.com');
630
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('github.com')).to.deep.equal({
631
+ url: 'https://api.github.com'
632
+ });
633
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('GHE.corp.example')).to.deep.equal({
634
+ url: GHES_API
635
+ });
636
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)()).to.deep.equal({
637
+ url: GHES_API
638
+ });
639
+ });
640
+ it('without GITHUB_API_URL, derives the GHES convention <server origin>/api/v3 — never api.github.com', () => {
641
+ delete process.env.GITHUB_API_URL;
642
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)()).to.deep.equal({
643
+ url: GHES_API
644
+ });
645
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('ghe.corp.example')).to.deep.equal({
646
+ url: GHES_API
647
+ });
648
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git')?.apiUrl).to.equal(GHES_API);
649
+ // the server's protocol and port carry over; its path does not
650
+ process.env.GITHUB_SERVER_URL = 'http://ghe.corp.example:8080/';
651
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('ghe.corp.example')).to.deep.equal({
652
+ url: 'http://ghe.corp.example:8080/api/v3'
653
+ });
654
+ // github.com is untouched by the enterprise default
655
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('github.com')).to.deep.equal({
656
+ url: 'https://api.github.com'
657
+ });
658
+ });
659
+ it('accepts a GITHUB_API_URL on api.<server host> (GHE.com data residency)', () => {
660
+ process.env.GITHUB_SERVER_URL = 'https://acme.ghe.com';
661
+ process.env.GITHUB_API_URL = 'https://api.acme.ghe.com';
662
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('acme.ghe.com')).to.deep.equal({
663
+ url: 'https://api.acme.ghe.com'
664
+ });
665
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv('https://acme.ghe.com/acme/store.git')?.apiUrl).to.equal('https://api.acme.ghe.com');
666
+ });
667
+ it('refuses a GITHUB_API_URL on another host: no client, a warning naming both values, no request', async () => {
668
+ const MISMATCHED = ['https://api.github.com', 'https://evil.example/api/v3', 'https://ghe.corp.example.evil.com/api/v3', 'https://api.ghe.corp.example.evil.com', 'not a url'];
669
+ for (const apiUrl of MISMATCHED) {
670
+ process.env.GITHUB_API_URL = apiUrl;
671
+ const result = (0, _githubClient().gitHubApiUrl)('ghe.corp.example');
672
+ (0, _chai().expect)(result, apiUrl).to.not.have.property('url');
673
+ (0, _chai().expect)(result.error, apiUrl).to.contain(apiUrl).and.contain(GHES_SERVER);
674
+ const warnings = [];
675
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git', m => warnings.push(m)), apiUrl).to.equal(undefined);
676
+ // a repository from GITHUB_REPOSITORY alone lives on the enterprise instance too
677
+ process.env.GITHUB_REPOSITORY = 'acme/store';
678
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv(undefined, m => warnings.push(m)), apiUrl).to.equal(undefined);
679
+ delete process.env.GITHUB_REPOSITORY;
680
+ (0, _chai().expect)(warnings, apiUrl).to.have.lengthOf(2);
681
+ warnings.forEach(w => (0, _chai().expect)(w, apiUrl).to.contain(`"${apiUrl}"`).and.contain(`"${GHES_SERVER}"`));
682
+
683
+ // the provider reports "not configured", warns once across retries, and sends nothing
684
+ const realFetch = globalThis.fetch;
685
+ const {
686
+ calls,
687
+ fetchImpl
688
+ } = recordingFetch();
689
+ globalThis.fetch = fetchImpl;
690
+ const providerWarnings = [];
691
+ try {
692
+ const provider = new (_githubClient().GitHubHostProvider)(m => providerWarnings.push(m));
693
+ (0, _chai().expect)(provider.isConfigured('git@ghe.corp.example:acme/store.git'), apiUrl).to.equal(false);
694
+ (0, _chai().expect)(provider.isConfigured('git@ghe.corp.example:acme/store.git'), apiUrl).to.equal(false);
695
+ let thrown;
696
+ await provider.findPrByBranch('lane-x').catch(e => {
697
+ thrown = e;
698
+ });
699
+ (0, _chai().expect)(thrown, apiUrl).to.be.instanceOf(Error);
700
+ } finally {
701
+ globalThis.fetch = realFetch;
702
+ }
703
+ (0, _chai().expect)(calls, apiUrl).to.have.lengthOf(0);
704
+ (0, _chai().expect)(providerWarnings, apiUrl).to.have.lengthOf(1);
705
+ }
706
+ // a github.com remote on the same misconfigured runner is unaffected
707
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv('git@github.com:acme/shop.git')?.apiUrl).to.equal('https://api.github.com');
708
+ });
709
+ it('never lets an https server hand its token to a plaintext or non-web API', () => {
710
+ ['http://ghe.corp.example/api/v3', 'http://api.ghe.corp.example', 'ftp://ghe.corp.example/api/v3'].forEach(apiUrl => {
711
+ process.env.GITHUB_API_URL = apiUrl;
712
+ const result = (0, _githubClient().gitHubApiUrl)('ghe.corp.example');
713
+ (0, _chai().expect)(result, apiUrl).to.not.have.property('url');
714
+ (0, _chai().expect)(result.error, apiUrl).to.contain(apiUrl).and.contain('is not https');
715
+ const warnings = [];
716
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git', m => warnings.push(m)), apiUrl).to.equal(undefined);
717
+ (0, _chai().expect)(warnings, apiUrl).to.have.lengthOf(1);
718
+ });
719
+ });
720
+ it('lets an http server use an http or https API on its host, but no other protocol', () => {
721
+ process.env.GITHUB_SERVER_URL = 'http://ghe.corp.example';
722
+ process.env.GITHUB_API_URL = 'http://ghe.corp.example/api/v3';
723
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('ghe.corp.example')).to.deep.equal({
724
+ url: 'http://ghe.corp.example/api/v3'
725
+ });
726
+ process.env.GITHUB_API_URL = 'https://ghe.corp.example/api/v3';
727
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('ghe.corp.example')).to.deep.equal({
728
+ url: 'https://ghe.corp.example/api/v3'
729
+ });
730
+ process.env.GITHUB_API_URL = 'ftp://ghe.corp.example/api/v3';
731
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('ghe.corp.example')).to.not.have.property('url');
732
+ // a non-web server URL derives no API at all
733
+ delete process.env.GITHUB_API_URL;
734
+ process.env.GITHUB_SERVER_URL = 'ftp://ghe.corp.example';
735
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)('ghe.corp.example')).to.not.have.property('url');
736
+ });
737
+ it('refuses a GITHUB_API_URL with a query or fragment, which would swallow the request path', () => {
738
+ ['https://ghe.corp.example/api/v3?x=1', 'https://ghe.corp.example/api/v3#frag'].forEach(apiUrl => {
739
+ process.env.GITHUB_API_URL = apiUrl;
740
+ const result = (0, _githubClient().gitHubApiUrl)('ghe.corp.example');
741
+ (0, _chai().expect)(result, apiUrl).to.not.have.property('url');
742
+ (0, _chai().expect)(result.error, apiUrl).to.contain(apiUrl).and.contain('query or fragment');
743
+ (0, _chai().expect)(_githubClient().GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git'), apiUrl).to.equal(undefined);
744
+ });
745
+ });
746
+ it('one provider reused for an enterprise origin and then a github.com origin talks to each one', async () => {
747
+ const realFetch = globalThis.fetch;
748
+ const {
749
+ calls,
750
+ fetchImpl
751
+ } = recordingFetch();
752
+ globalThis.fetch = fetchImpl;
753
+ try {
754
+ const provider = new (_githubClient().GitHubHostProvider)();
755
+ // a PR call carries no remote: it follows the remote last selected
756
+ (0, _chai().expect)(provider.matchesRemote('git@ghe.corp.example:acme/store.git')).to.equal(true);
757
+ (0, _chai().expect)(provider.isConfigured('git@ghe.corp.example:acme/store.git')).to.equal(true);
758
+ await provider.findPrByBranch('lane-x');
759
+ (0, _chai().expect)(provider.isConfigured('git@github.com:acme/shop.git')).to.equal(true);
760
+ await provider.findPrByBranch('lane-x');
761
+ } finally {
762
+ globalThis.fetch = realFetch;
763
+ }
764
+ (0, _chai().expect)(calls.map(c => c.url)).to.deep.equal([`${GHES_API}/repos/acme/store/pulls?state=open&head=acme%3Alane-x`, 'https://api.github.com/repos/acme/shop/pulls?state=open&head=acme%3Alane-x']);
765
+ });
766
+ it('drops a trailing slash from GITHUB_API_URL', () => {
767
+ process.env.GITHUB_API_URL = `${GHES_API}/`;
768
+ (0, _chai().expect)((0, _githubClient().gitHubApiUrl)()).to.deep.equal({
769
+ url: GHES_API
770
+ });
771
+ });
772
+ it('follows pagination on the GHES API, and refuses a next link that leaves it', async () => {
773
+ const calls = [];
774
+ const fetchImpl = async (url, init) => {
775
+ calls.push({
776
+ url: String(url),
777
+ init
778
+ });
779
+ const page2 = String(url).includes('page=2');
780
+ return new Response(JSON.stringify([{
781
+ id: page2 ? 2 : 1,
782
+ body: 'unrelated'
783
+ }]), {
784
+ status: 200,
785
+ headers: {
786
+ 'content-type': 'application/json',
787
+ link: page2 ? '<https://api.github.com/repos/acme/store/issues/7/comments?page=3>; rel="next"' : `<${GHES_API}/repos/acme/store/issues/7/comments?per_page=100&page=2>; rel="next"`
788
+ }
789
+ });
790
+ };
791
+ const client = new (_githubClient().GitHubClient)({
792
+ token: 'tok',
793
+ repo: 'acme/store',
794
+ apiUrl: GHES_API,
795
+ fetchImpl
796
+ });
797
+ await client.upsertComment(7, '<!-- marker -->', 'cleared', {
798
+ createIfAbsent: false
799
+ });
800
+ (0, _chai().expect)(calls.map(c => c.url)).to.deep.equal([`${GHES_API}/repos/acme/store/issues/7/comments?per_page=100`, `${GHES_API}/repos/acme/store/issues/7/comments?per_page=100&page=2`]);
801
+ });
802
+ });
803
+ });
804
+
454
805
  //# sourceMappingURL=github-client.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_chai","data","require","_githubClient","REMOTES","undefined","describe","it","forEach","url","repo","isGitHub","expect","parseGitHubRepo","to","equal","isGitHubRemote","envKeys","saved","beforeEach","key","process","env","GITHUB_TOKEN","afterEach","OURS","RESOLUTION","name","repository","remote","warns","GITHUB_REPOSITORY","warnings","client","GitHubClient","fromEnv","message","push","fragment","join","contain","deep","realFetch","calls","globalThis","fetch","init","String","Response","JSON","stringify","status","headers","sentToken","findPrByBranch","authorization","PRECEDENCE","BIT_GITHUB_TOKEN","expected","Object","entries","value","have","lengthOf","fakeFetch","number","state","labels","head","ref","html_url","token","fetchImpl","pr","createPr","base","title","body","method","parse","fakeFetchOver","existingComments","upsertComment","posts","filter","c","id","patches","some","createIfAbsent","includes","link","gets","include","thrown","catch","e","be","an"],"sources":["github-client.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { GitHubClient, isGitHubRemote, parseGitHubRepo } from './github-client';\n\n/**\n * A claimed remote the parse then fails on silently degrades the whole run to PR-less mode, so the two\n * predicates are pinned over the same remote shapes: whatever `isGitHubRemote` claims must parse.\n */\nconst REMOTES: Array<[string, string | undefined, boolean]> = [\n // url, parseGitHubRepo, isGitHubRemote\n ['git@github.com:acme/shop.git', 'acme/shop', true],\n ['https://github.com/acme/shop.git', 'acme/shop', true],\n ['https://github.com/acme/shop', 'acme/shop', true],\n ['ssh://git@github.com/acme/shop.git', 'acme/shop', true],\n // mixed-case host, an explicit port, and credentials in the url are all still github.com\n ['https://GitHub.com/acme/shop.git', 'acme/shop', true],\n ['https://github.com:443/acme/shop.git', 'acme/shop', true],\n ['ssh://git@github.com:22/acme/shop.git', 'acme/shop', true],\n ['https://x-access-token:tok@github.com/acme/shop.git', 'acme/shop', true],\n // an all-digits scp owner is an owner, never a port\n ['git@github.com:12345/shop.git', '12345/shop', true],\n // another host that merely has \"github.com\" in its path, in both url forms\n ['https://gitlab.example.com/mirrors/github.com/acme/repo.git', undefined, false],\n ['git@gitlab.example.com:mirrors/github.com/acme/repo.git', undefined, false],\n // look-alike and unrelated hosts\n ['https://mygithub.com/acme/shop', undefined, false],\n ['https://github.company.com/acme/shop', undefined, false],\n ['git@gitlab.com:acme/shop.git', undefined, false],\n ['https://gitlab.com/acme/shop.git', undefined, false],\n ['/srv/git/github.com/acme/shop.git', undefined, false],\n];\n\ndescribe('parseGitHubRepo / isGitHubRemote', () => {\n it('agree on every remote form git accepts, and on every host that is not github.com', () => {\n REMOTES.forEach(([url, repo, isGitHub]) => {\n expect(parseGitHubRepo(url), url).to.equal(repo);\n expect(isGitHubRemote(url), url).to.equal(isGitHub);\n });\n });\n});\n\ndescribe('GitHubClient.fromEnv', () => {\n const envKeys = ['GITHUB_TOKEN', 'BIT_GITHUB_TOKEN', 'GITHUB_REPOSITORY'] as const;\n const saved: Record<string, string | undefined> = {};\n\n beforeEach(() => {\n envKeys.forEach((key) => {\n saved[key] = process.env[key];\n delete process.env[key];\n });\n process.env.GITHUB_TOKEN = 'tok';\n });\n\n afterEach(() => {\n envKeys.forEach((key) => {\n if (saved[key] === undefined) delete process.env[key];\n else process.env[key] = saved[key];\n });\n });\n\n const OURS = 'git@github.com:acme/shop.git';\n /** [case, GITHUB_REPOSITORY, remote, resolved repo, warning fragments]. */\n const RESOLUTION: Array<[string, string, string | undefined, string | undefined, string[]?]> = [\n ['the remote and the environment agree', 'acme/shop', OURS, 'acme/shop'],\n // the ORIGIN-parsed repository outranks GITHUB_REPOSITORY, and the disagreement must be reported\n ['they disagree', 'other-org/other-repo', OURS, 'acme/shop', ['other-org/other-repo', 'acme/shop']],\n // GitHub repository names are case-insensitive, so a case-only difference is not a disagreement\n ['they differ only in case', 'Acme/Shop', OURS, 'acme/shop'],\n ['there is no remote to parse', 'acme/shop', undefined, 'acme/shop'],\n ['the remote is a github url nothing parses out of', 'acme/shop', 'https://github.com/', 'acme/shop'],\n // a remote that is demonstrably not github stays unconfigured however complete the environment is\n ['the remote is another host', 'acme/shop', 'https://gitlab.com/acme/shop.git', undefined],\n ['the remote is a look-alike host', 'acme/shop', 'https://mygithub.com/acme/shop', undefined],\n ];\n\n RESOLUTION.forEach(([name, repository, remote, repo, warns]) => {\n it(`resolves the repository when ${name}`, () => {\n process.env.GITHUB_REPOSITORY = repository;\n const warnings: string[] = [];\n const client = GitHubClient.fromEnv(remote, (message) => warnings.push(message));\n expect(client?.repo).to.equal(repo);\n (warns ?? []).forEach((fragment) => expect(warnings.join('\\n')).to.contain(fragment));\n if (!warns) expect(warnings).to.deep.equal([]);\n });\n });\n\n it('needs a token: a repository on its own configures nothing', () => {\n delete process.env.GITHUB_TOKEN;\n process.env.GITHUB_REPOSITORY = 'acme/shop';\n expect(GitHubClient.fromEnv('git@github.com:acme/shop.git')).to.equal(undefined);\n });\n\n // Asserted through the `authorization` header, so what is pinned is the token the client actually\n // sends. The fetch stub must be installed before `fromEnv` runs.\n describe('token precedence', () => {\n let realFetch: typeof fetch;\n let calls: Array<{ url: string; init: any }>;\n\n beforeEach(() => {\n realFetch = globalThis.fetch;\n calls = [];\n globalThis.fetch = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n return new Response(JSON.stringify([]), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n });\n\n afterEach(() => {\n globalThis.fetch = realFetch;\n });\n\n /** The token a client built from this environment puts on the wire. */\n async function sentToken(): Promise<string | undefined> {\n const client = GitHubClient.fromEnv('git@github.com:acme/shop.git');\n await client?.findPrByBranch('lane-x');\n return calls[0]?.init?.headers?.authorization;\n }\n\n const PRECEDENCE: Array<[string, Record<string, string | undefined>, string]> = [\n // the override beats the ambient default\n ['both set', { GITHUB_TOKEN: 'workflow-token', BIT_GITHUB_TOKEN: 'user-pat' }, 'Bearer user-pat'],\n // the ordinary Actions job\n ['only GITHUB_TOKEN', { GITHUB_TOKEN: 'workflow-token' }, 'Bearer workflow-token'],\n // any CI that is not Actions\n ['only BIT_GITHUB_TOKEN', { BIT_GITHUB_TOKEN: 'user-pat' }, 'Bearer user-pat'],\n ['an EMPTY override', { GITHUB_TOKEN: 'workflow-token', BIT_GITHUB_TOKEN: '' }, 'Bearer workflow-token'],\n ];\n\n PRECEDENCE.forEach(([name, env, expected]) => {\n it(`sends the right token with ${name}`, async () => {\n delete process.env.GITHUB_TOKEN;\n Object.entries(env).forEach(([key, value]) => {\n process.env[key] = value;\n });\n expect(await sentToken()).to.equal(expected);\n });\n });\n\n it('is not configured when neither token is set, and puts nothing on the wire', async () => {\n delete process.env.GITHUB_TOKEN;\n process.env.GITHUB_REPOSITORY = 'acme/shop';\n expect(GitHubClient.fromEnv('git@github.com:acme/shop.git')).to.equal(undefined);\n expect(calls).to.have.lengthOf(0);\n });\n });\n});\n\ndescribe('GitHubClient', () => {\n it('createPr posts the pull-request payload to the pulls endpoint', async () => {\n const calls: Array<{ url: string; init: any }> = [];\n const fakeFetch = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n return new Response(\n JSON.stringify({ number: 7, state: 'open', labels: [], head: { ref: 'lane-x' }, html_url: 'http://pr/7' }),\n { status: 201, headers: { 'content-type': 'application/json' } }\n );\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl: fakeFetch });\n const pr = await client.createPr({ head: 'lane-x', base: 'main', title: 't', body: 'b' });\n expect(pr.number).to.equal(7);\n expect(calls[0].url).to.equal('https://api.github.com/repos/acme/shop/pulls');\n expect(calls[0].init.method).to.equal('POST');\n expect(JSON.parse(calls[0].init.body)).to.deep.equal({ head: 'lane-x', base: 'main', title: 't', body: 'b' });\n });\n\n it('findPrByBranch returns undefined on empty list', async () => {\n const fakeFetch = (async () =>\n new Response(JSON.stringify([]), {\n status: 200,\n headers: { 'content-type': 'application/json' },\n })) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl: fakeFetch });\n expect(await client.findPrByBranch('lane-x')).to.equal(undefined);\n });\n\n describe('upsertComment', () => {\n // named `upsertComment`, matching `GitHostProvider.upsertComment` exactly — see the method's\n // own doc comment for why a differently-named method would be a silent-no-op trap.\n function fakeFetchOver(existingComments: Array<{ id: number; body: string }>) {\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n const method = init?.method ?? 'GET';\n if (method === 'GET') {\n return new Response(JSON.stringify(existingComments), {\n status: 200,\n headers: { 'content-type': 'application/json' },\n });\n }\n return new Response(JSON.stringify({}), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n return { calls, fetchImpl };\n }\n\n it('posts a new comment when no marked comment exists', async () => {\n const { calls, fetchImpl } = fakeFetchOver([]);\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nbody');\n const posts = calls.filter((c) => c.init?.method === 'POST');\n expect(posts).to.have.lengthOf(1);\n expect(posts[0].url).to.equal('https://api.github.com/repos/acme/shop/issues/7/comments');\n });\n\n it('patches the marked comment in place, and never posts a second one', async () => {\n const { calls, fetchImpl } = fakeFetchOver([\n { id: 42, body: 'unrelated comment' },\n { id: 99, body: '<!-- marker -->\\nold report' },\n ]);\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nnew report');\n const patches = calls.filter((c) => c.init?.method === 'PATCH');\n expect(patches).to.have.lengthOf(1);\n expect(patches[0].url).to.equal('https://api.github.com/repos/acme/shop/issues/comments/99');\n expect(JSON.parse(patches[0].init.body)).to.deep.equal({ body: '<!-- marker -->\\nnew report' });\n expect(calls.some((c) => c.init?.method === 'POST')).to.equal(false);\n });\n\n it('skips silently when createIfAbsent is false and no marked comment exists', async () => {\n const { calls, fetchImpl } = fakeFetchOver([]);\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', 'cleared', { createIfAbsent: false });\n expect(calls.some((c) => c.init?.method === 'POST' || c.init?.method === 'PATCH')).to.equal(false);\n });\n\n it('lists at per_page=100 and follows Link-header pagination to find a comment past page 1', async () => {\n // GitHub defaults to per_page=30; a naive single-page list would miss this comment and post a\n // duplicate report on every push instead of updating it.\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n const method = init?.method ?? 'GET';\n if (method === 'GET' && !String(url).includes('page=2')) {\n return new Response(JSON.stringify([{ id: 1, body: 'unrelated' }]), {\n status: 200,\n headers: {\n 'content-type': 'application/json',\n link: '<https://api.github.com/repos/acme/shop/issues/7/comments?per_page=100&page=2>; rel=\"next\"',\n },\n });\n }\n if (method === 'GET') {\n return new Response(JSON.stringify([{ id: 99, body: '<!-- marker -->\\nold report' }]), {\n status: 200,\n headers: { 'content-type': 'application/json' },\n });\n }\n return new Response(JSON.stringify({}), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nnew report');\n\n const gets = calls.filter((c) => (c.init?.method ?? 'GET') === 'GET');\n expect(gets).to.have.lengthOf(2);\n expect(gets[0].url).to.include('per_page=100');\n expect(gets[1].url).to.equal('https://api.github.com/repos/acme/shop/issues/7/comments?per_page=100&page=2');\n const patches = calls.filter((c) => c.init?.method === 'PATCH');\n expect(patches).to.have.lengthOf(1);\n expect(patches[0].url).to.equal('https://api.github.com/repos/acme/shop/issues/comments/99');\n // the found-on-page-2 comment was updated, not duplicated\n expect(calls.some((c) => c.init?.method === 'POST')).to.equal(false);\n });\n\n it('refuses to follow a Link header that leaves api.github.com — the token stays home', async () => {\n // The next-page URL is response data, and requestRaw attaches the bearer token to whatever URL\n // it is handed — an off-host \"next\" link must read as \"last page\", never as a request target.\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n const method = init?.method ?? 'GET';\n if (method === 'GET') {\n return new Response(JSON.stringify([{ id: 1, body: 'unrelated' }]), {\n status: 200,\n headers: {\n 'content-type': 'application/json',\n link: '<https://evil.test/repos/acme/shop/issues/7/comments?page=2>; rel=\"next\"',\n },\n });\n }\n return new Response(JSON.stringify({}), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nbody');\n\n expect(calls.some((c) => c.url.includes('evil.test'))).to.equal(false);\n const gets = calls.filter((c) => (c.init?.method ?? 'GET') === 'GET');\n expect(gets, 'the off-host link is the last page, not a loop').to.have.lengthOf(1);\n });\n\n it('stops paginating as soon as the marked comment is seen', async () => {\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n const method = init?.method ?? 'GET';\n if (method === 'GET') {\n return new Response(JSON.stringify([{ id: 99, body: '<!-- marker -->\\nold report' }]), {\n status: 200,\n headers: {\n 'content-type': 'application/json',\n link: '<https://api.github.com/repos/acme/shop/issues/7/comments?per_page=100&page=2>; rel=\"next\"',\n },\n });\n }\n return new Response(JSON.stringify({}), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nnew report');\n\n const gets = calls.filter((c) => (c.init?.method ?? 'GET') === 'GET');\n expect(gets, 'the match on page 1 makes page 2 pointless').to.have.lengthOf(1);\n expect(calls.filter((c) => c.init?.method === 'PATCH')).to.have.lengthOf(1);\n });\n\n it('exhausting the page budget throws instead of posting a duplicate', async () => {\n // \"Ran out of budget\" must not read as \"absent\": a POST here would add a duplicate report on\n // every later push. The throw surfaces through the caller's existing warn-and-skip path.\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n return new Response(JSON.stringify([{ id: 1, body: 'unrelated' }]), {\n status: 200,\n headers: {\n 'content-type': 'application/json',\n link: '<https://api.github.com/repos/acme/shop/issues/7/comments?per_page=100&page=2>; rel=\"next\"',\n },\n });\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n let thrown: Error | undefined;\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nbody').catch((e) => (thrown = e));\n\n expect(thrown, 'the budget exhaustion is an error, not an absence').to.be.an('error');\n expect(calls.some((c) => c.init?.method === 'POST')).to.equal(false);\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,cAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACA;AACA,MAAMG,OAAqD,GAAG;AAC5D;AACA,CAAC,8BAA8B,EAAE,WAAW,EAAE,IAAI,CAAC,EACnD,CAAC,kCAAkC,EAAE,WAAW,EAAE,IAAI,CAAC,EACvD,CAAC,8BAA8B,EAAE,WAAW,EAAE,IAAI,CAAC,EACnD,CAAC,oCAAoC,EAAE,WAAW,EAAE,IAAI,CAAC;AACzD;AACA,CAAC,kCAAkC,EAAE,WAAW,EAAE,IAAI,CAAC,EACvD,CAAC,sCAAsC,EAAE,WAAW,EAAE,IAAI,CAAC,EAC3D,CAAC,uCAAuC,EAAE,WAAW,EAAE,IAAI,CAAC,EAC5D,CAAC,qDAAqD,EAAE,WAAW,EAAE,IAAI,CAAC;AAC1E;AACA,CAAC,+BAA+B,EAAE,YAAY,EAAE,IAAI,CAAC;AACrD;AACA,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J,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_chai","data","require","_githubClient","REMOTES","undefined","describe","it","forEach","url","repo","isGitHub","expect","parseGitHubRepo","to","equal","isGitHubRemote","envKeys","saved","beforeEach","key","process","env","GITHUB_TOKEN","afterEach","OURS","RESOLUTION","name","repository","remote","warns","GITHUB_REPOSITORY","warnings","client","GitHubClient","fromEnv","message","push","fragment","join","contain","deep","realFetch","calls","globalThis","fetch","init","String","Response","JSON","stringify","status","headers","sentToken","findPrByBranch","authorization","PRECEDENCE","BIT_GITHUB_TOKEN","expected","Object","entries","value","have","lengthOf","fakeFetch","number","state","labels","head","ref","html_url","token","fetchImpl","pr","createPr","base","title","body","method","parse","fakeFetchOver","existingComments","upsertComment","posts","filter","c","id","patches","some","createIfAbsent","includes","link","gets","include","thrown","catch","e","be","an","GHES_SERVER","GHES_API","recordingFetch","PR","GITHUB_DOT_COM_ENVS","GITHUB_API_URL","GITHUB_SERVER_URL","assign","gitHubApiUrl","apiUrl","GHES_REMOTES","matchesRemote","wired","addLabel","closePr","map","match","MISMATCHED","result","not","property","error","and","m","w","providerWarnings","provider","GitHubHostProvider","isConfigured","instanceOf","Error","page2"],"sources":["github-client.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { GitHubClient, GitHubHostProvider, gitHubApiUrl, isGitHubRemote, parseGitHubRepo } from './github-client';\n\n/**\n * A claimed remote the parse then fails on silently degrades the whole run to PR-less mode, so the two\n * predicates are pinned over the same remote shapes: whatever `isGitHubRemote` claims must parse.\n */\nconst REMOTES: Array<[string, string | undefined, boolean]> = [\n // url, parseGitHubRepo, isGitHubRemote\n ['git@github.com:acme/shop.git', 'acme/shop', true],\n ['https://github.com/acme/shop.git', 'acme/shop', true],\n ['https://github.com/acme/shop', 'acme/shop', true],\n ['ssh://git@github.com/acme/shop.git', 'acme/shop', true],\n // mixed-case host, an explicit port, and credentials in the url are all still github.com\n ['https://GitHub.com/acme/shop.git', 'acme/shop', true],\n ['https://github.com:443/acme/shop.git', 'acme/shop', true],\n ['ssh://git@github.com:22/acme/shop.git', 'acme/shop', true],\n ['https://x-access-token:tok@github.com/acme/shop.git', 'acme/shop', true],\n // an all-digits scp owner is an owner, never a port\n ['git@github.com:12345/shop.git', '12345/shop', true],\n // another host that merely has \"github.com\" in its path, in both url forms\n ['https://gitlab.example.com/mirrors/github.com/acme/repo.git', undefined, false],\n ['git@gitlab.example.com:mirrors/github.com/acme/repo.git', undefined, false],\n // look-alike and unrelated hosts\n ['https://mygithub.com/acme/shop', undefined, false],\n ['https://github.company.com/acme/shop', undefined, false],\n ['git@gitlab.com:acme/shop.git', undefined, false],\n ['https://gitlab.com/acme/shop.git', undefined, false],\n ['/srv/git/github.com/acme/shop.git', undefined, false],\n];\n\ndescribe('parseGitHubRepo / isGitHubRemote', () => {\n it('agree on every remote form git accepts, and on every host that is not github.com', () => {\n REMOTES.forEach(([url, repo, isGitHub]) => {\n expect(parseGitHubRepo(url), url).to.equal(repo);\n expect(isGitHubRemote(url), url).to.equal(isGitHub);\n });\n });\n});\n\ndescribe('GitHubClient.fromEnv', () => {\n const envKeys = ['GITHUB_TOKEN', 'BIT_GITHUB_TOKEN', 'GITHUB_REPOSITORY'] as const;\n const saved: Record<string, string | undefined> = {};\n\n beforeEach(() => {\n envKeys.forEach((key) => {\n saved[key] = process.env[key];\n delete process.env[key];\n });\n process.env.GITHUB_TOKEN = 'tok';\n });\n\n afterEach(() => {\n envKeys.forEach((key) => {\n if (saved[key] === undefined) delete process.env[key];\n else process.env[key] = saved[key];\n });\n });\n\n const OURS = 'git@github.com:acme/shop.git';\n /** [case, GITHUB_REPOSITORY, remote, resolved repo, warning fragments]. */\n const RESOLUTION: Array<[string, string, string | undefined, string | undefined, string[]?]> = [\n ['the remote and the environment agree', 'acme/shop', OURS, 'acme/shop'],\n // the ORIGIN-parsed repository outranks GITHUB_REPOSITORY, and the disagreement must be reported\n ['they disagree', 'other-org/other-repo', OURS, 'acme/shop', ['other-org/other-repo', 'acme/shop']],\n // GitHub repository names are case-insensitive, so a case-only difference is not a disagreement\n ['they differ only in case', 'Acme/Shop', OURS, 'acme/shop'],\n ['there is no remote to parse', 'acme/shop', undefined, 'acme/shop'],\n ['the remote is a github url nothing parses out of', 'acme/shop', 'https://github.com/', 'acme/shop'],\n // a remote that is demonstrably not github stays unconfigured however complete the environment is\n ['the remote is another host', 'acme/shop', 'https://gitlab.com/acme/shop.git', undefined],\n ['the remote is a look-alike host', 'acme/shop', 'https://mygithub.com/acme/shop', undefined],\n ];\n\n RESOLUTION.forEach(([name, repository, remote, repo, warns]) => {\n it(`resolves the repository when ${name}`, () => {\n process.env.GITHUB_REPOSITORY = repository;\n const warnings: string[] = [];\n const client = GitHubClient.fromEnv(remote, (message) => warnings.push(message));\n expect(client?.repo).to.equal(repo);\n (warns ?? []).forEach((fragment) => expect(warnings.join('\\n')).to.contain(fragment));\n if (!warns) expect(warnings).to.deep.equal([]);\n });\n });\n\n it('needs a token: a repository on its own configures nothing', () => {\n delete process.env.GITHUB_TOKEN;\n process.env.GITHUB_REPOSITORY = 'acme/shop';\n expect(GitHubClient.fromEnv('git@github.com:acme/shop.git')).to.equal(undefined);\n });\n\n // Asserted through the `authorization` header, so what is pinned is the token the client actually\n // sends. The fetch stub must be installed before `fromEnv` runs.\n describe('token precedence', () => {\n let realFetch: typeof fetch;\n let calls: Array<{ url: string; init: any }>;\n\n beforeEach(() => {\n realFetch = globalThis.fetch;\n calls = [];\n globalThis.fetch = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n return new Response(JSON.stringify([]), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n });\n\n afterEach(() => {\n globalThis.fetch = realFetch;\n });\n\n /** The token a client built from this environment puts on the wire. */\n async function sentToken(): Promise<string | undefined> {\n const client = GitHubClient.fromEnv('git@github.com:acme/shop.git');\n await client?.findPrByBranch('lane-x');\n return calls[0]?.init?.headers?.authorization;\n }\n\n const PRECEDENCE: Array<[string, Record<string, string | undefined>, string]> = [\n // the override beats the ambient default\n ['both set', { GITHUB_TOKEN: 'workflow-token', BIT_GITHUB_TOKEN: 'user-pat' }, 'Bearer user-pat'],\n // the ordinary Actions job\n ['only GITHUB_TOKEN', { GITHUB_TOKEN: 'workflow-token' }, 'Bearer workflow-token'],\n // any CI that is not Actions\n ['only BIT_GITHUB_TOKEN', { BIT_GITHUB_TOKEN: 'user-pat' }, 'Bearer user-pat'],\n ['an EMPTY override', { GITHUB_TOKEN: 'workflow-token', BIT_GITHUB_TOKEN: '' }, 'Bearer workflow-token'],\n ];\n\n PRECEDENCE.forEach(([name, env, expected]) => {\n it(`sends the right token with ${name}`, async () => {\n delete process.env.GITHUB_TOKEN;\n Object.entries(env).forEach(([key, value]) => {\n process.env[key] = value;\n });\n expect(await sentToken()).to.equal(expected);\n });\n });\n\n it('is not configured when neither token is set, and puts nothing on the wire', async () => {\n delete process.env.GITHUB_TOKEN;\n process.env.GITHUB_REPOSITORY = 'acme/shop';\n expect(GitHubClient.fromEnv('git@github.com:acme/shop.git')).to.equal(undefined);\n expect(calls).to.have.lengthOf(0);\n });\n });\n});\n\ndescribe('GitHubClient', () => {\n it('createPr posts the pull-request payload to the pulls endpoint', async () => {\n const calls: Array<{ url: string; init: any }> = [];\n const fakeFetch = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n return new Response(\n JSON.stringify({ number: 7, state: 'open', labels: [], head: { ref: 'lane-x' }, html_url: 'http://pr/7' }),\n { status: 201, headers: { 'content-type': 'application/json' } }\n );\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl: fakeFetch });\n const pr = await client.createPr({ head: 'lane-x', base: 'main', title: 't', body: 'b' });\n expect(pr.number).to.equal(7);\n expect(calls[0].url).to.equal('https://api.github.com/repos/acme/shop/pulls');\n expect(calls[0].init.method).to.equal('POST');\n expect(JSON.parse(calls[0].init.body)).to.deep.equal({ head: 'lane-x', base: 'main', title: 't', body: 'b' });\n });\n\n it('findPrByBranch returns undefined on empty list', async () => {\n const fakeFetch = (async () =>\n new Response(JSON.stringify([]), {\n status: 200,\n headers: { 'content-type': 'application/json' },\n })) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl: fakeFetch });\n expect(await client.findPrByBranch('lane-x')).to.equal(undefined);\n });\n\n describe('upsertComment', () => {\n // named `upsertComment`, matching `GitHostProvider.upsertComment` exactly — see the method's\n // own doc comment for why a differently-named method would be a silent-no-op trap.\n function fakeFetchOver(existingComments: Array<{ id: number; body: string }>) {\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n const method = init?.method ?? 'GET';\n if (method === 'GET') {\n return new Response(JSON.stringify(existingComments), {\n status: 200,\n headers: { 'content-type': 'application/json' },\n });\n }\n return new Response(JSON.stringify({}), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n return { calls, fetchImpl };\n }\n\n it('posts a new comment when no marked comment exists', async () => {\n const { calls, fetchImpl } = fakeFetchOver([]);\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nbody');\n const posts = calls.filter((c) => c.init?.method === 'POST');\n expect(posts).to.have.lengthOf(1);\n expect(posts[0].url).to.equal('https://api.github.com/repos/acme/shop/issues/7/comments');\n });\n\n it('patches the marked comment in place, and never posts a second one', async () => {\n const { calls, fetchImpl } = fakeFetchOver([\n { id: 42, body: 'unrelated comment' },\n { id: 99, body: '<!-- marker -->\\nold report' },\n ]);\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nnew report');\n const patches = calls.filter((c) => c.init?.method === 'PATCH');\n expect(patches).to.have.lengthOf(1);\n expect(patches[0].url).to.equal('https://api.github.com/repos/acme/shop/issues/comments/99');\n expect(JSON.parse(patches[0].init.body)).to.deep.equal({ body: '<!-- marker -->\\nnew report' });\n expect(calls.some((c) => c.init?.method === 'POST')).to.equal(false);\n });\n\n it('skips silently when createIfAbsent is false and no marked comment exists', async () => {\n const { calls, fetchImpl } = fakeFetchOver([]);\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', 'cleared', { createIfAbsent: false });\n expect(calls.some((c) => c.init?.method === 'POST' || c.init?.method === 'PATCH')).to.equal(false);\n });\n\n it('lists at per_page=100 and follows Link-header pagination to find a comment past page 1', async () => {\n // GitHub defaults to per_page=30; a naive single-page list would miss this comment and post a\n // duplicate report on every push instead of updating it.\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n const method = init?.method ?? 'GET';\n if (method === 'GET' && !String(url).includes('page=2')) {\n return new Response(JSON.stringify([{ id: 1, body: 'unrelated' }]), {\n status: 200,\n headers: {\n 'content-type': 'application/json',\n link: '<https://api.github.com/repos/acme/shop/issues/7/comments?per_page=100&page=2>; rel=\"next\"',\n },\n });\n }\n if (method === 'GET') {\n return new Response(JSON.stringify([{ id: 99, body: '<!-- marker -->\\nold report' }]), {\n status: 200,\n headers: { 'content-type': 'application/json' },\n });\n }\n return new Response(JSON.stringify({}), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nnew report');\n\n const gets = calls.filter((c) => (c.init?.method ?? 'GET') === 'GET');\n expect(gets).to.have.lengthOf(2);\n expect(gets[0].url).to.include('per_page=100');\n expect(gets[1].url).to.equal('https://api.github.com/repos/acme/shop/issues/7/comments?per_page=100&page=2');\n const patches = calls.filter((c) => c.init?.method === 'PATCH');\n expect(patches).to.have.lengthOf(1);\n expect(patches[0].url).to.equal('https://api.github.com/repos/acme/shop/issues/comments/99');\n // the found-on-page-2 comment was updated, not duplicated\n expect(calls.some((c) => c.init?.method === 'POST')).to.equal(false);\n });\n\n it('refuses to follow a Link header that leaves api.github.com — the token stays home', async () => {\n // The next-page URL is response data, and requestRaw attaches the bearer token to whatever URL\n // it is handed — an off-host \"next\" link must read as \"last page\", never as a request target.\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n const method = init?.method ?? 'GET';\n if (method === 'GET') {\n return new Response(JSON.stringify([{ id: 1, body: 'unrelated' }]), {\n status: 200,\n headers: {\n 'content-type': 'application/json',\n link: '<https://evil.test/repos/acme/shop/issues/7/comments?page=2>; rel=\"next\"',\n },\n });\n }\n return new Response(JSON.stringify({}), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nbody');\n\n expect(calls.some((c) => c.url.includes('evil.test'))).to.equal(false);\n const gets = calls.filter((c) => (c.init?.method ?? 'GET') === 'GET');\n expect(gets, 'the off-host link is the last page, not a loop').to.have.lengthOf(1);\n });\n\n it('stops paginating as soon as the marked comment is seen', async () => {\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n const method = init?.method ?? 'GET';\n if (method === 'GET') {\n return new Response(JSON.stringify([{ id: 99, body: '<!-- marker -->\\nold report' }]), {\n status: 200,\n headers: {\n 'content-type': 'application/json',\n link: '<https://api.github.com/repos/acme/shop/issues/7/comments?per_page=100&page=2>; rel=\"next\"',\n },\n });\n }\n return new Response(JSON.stringify({}), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nnew report');\n\n const gets = calls.filter((c) => (c.init?.method ?? 'GET') === 'GET');\n expect(gets, 'the match on page 1 makes page 2 pointless').to.have.lengthOf(1);\n expect(calls.filter((c) => c.init?.method === 'PATCH')).to.have.lengthOf(1);\n });\n\n it('exhausting the page budget throws instead of posting a duplicate', async () => {\n // \"Ran out of budget\" must not read as \"absent\": a POST here would add a duplicate report on\n // every later push. The throw surfaces through the caller's existing warn-and-skip path.\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n return new Response(JSON.stringify([{ id: 1, body: 'unrelated' }]), {\n status: 200,\n headers: {\n 'content-type': 'application/json',\n link: '<https://api.github.com/repos/acme/shop/issues/7/comments?per_page=100&page=2>; rel=\"next\"',\n },\n });\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/shop', fetchImpl });\n let thrown: Error | undefined;\n await client.upsertComment(7, '<!-- marker -->', '<!-- marker -->\\nbody').catch((e) => (thrown = e));\n\n expect(thrown, 'the budget exhaustion is an error, not an absence').to.be.an('error');\n expect(calls.some((c) => c.init?.method === 'POST')).to.equal(false);\n });\n });\n});\n\n/**\n * GitHub Enterprise Server: Actions sets `GITHUB_SERVER_URL` and `GITHUB_API_URL` on every runner, and\n * those two variables are all that turns a GHES remote into a GitHub one. On github.com Actions sets them\n * to github.com's own values, which must read exactly like leaving them unset.\n */\ndescribe('GitHub Enterprise Server', () => {\n const GHES_SERVER = 'https://ghe.corp.example';\n const GHES_API = 'https://ghe.corp.example/api/v3';\n const envKeys = ['GITHUB_TOKEN', 'BIT_GITHUB_TOKEN', 'GITHUB_REPOSITORY', 'GITHUB_API_URL', 'GITHUB_SERVER_URL'];\n const saved: Record<string, string | undefined> = {};\n\n beforeEach(() => {\n envKeys.forEach((key) => {\n saved[key] = process.env[key];\n delete process.env[key];\n });\n process.env.GITHUB_TOKEN = 'tok';\n });\n\n afterEach(() => {\n envKeys.forEach((key) => {\n if (saved[key] === undefined) delete process.env[key];\n else process.env[key] = saved[key];\n });\n });\n\n /** Records every request a client built from the environment makes, answering with `body`. */\n function recordingFetch(body: unknown = []) {\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n return new Response(JSON.stringify(body), { status: 200, headers: { 'content-type': 'application/json' } });\n }) as typeof fetch;\n return { calls, fetchImpl };\n }\n\n const PR = { number: 7, state: 'open', labels: [], head: { ref: 'lane-x' }, html_url: 'http://pr/7' };\n\n describe('with neither variable set, or both naming github.com', () => {\n const GITHUB_DOT_COM_ENVS: Array<[string, Record<string, string>]> = [\n ['unset', {}],\n [\n 'set by a github.com runner',\n { GITHUB_API_URL: 'https://api.github.com', GITHUB_SERVER_URL: 'https://github.com' },\n ],\n ];\n\n GITHUB_DOT_COM_ENVS.forEach(([name, env]) => {\n it(`talks to api.github.com and claims github.com remotes only (${name})`, async () => {\n Object.assign(process.env, env);\n expect(gitHubApiUrl()).to.deep.equal({ url: 'https://api.github.com' });\n REMOTES.forEach(([url, repo, isGitHub]) => {\n expect(parseGitHubRepo(url), url).to.equal(repo);\n expect(isGitHubRemote(url), url).to.equal(isGitHub);\n });\n expect(isGitHubRemote('https://ghe.corp.example/acme/store.git')).to.equal(false);\n expect(GitHubClient.fromEnv('https://ghe.corp.example/acme/store.git')).to.equal(undefined);\n\n const client = GitHubClient.fromEnv('git@github.com:acme/shop.git');\n expect(client?.apiUrl).to.equal('https://api.github.com');\n const { calls, fetchImpl } = recordingFetch(PR);\n await new GitHubClient({ token: 'tok', repo: client!.repo, apiUrl: client!.apiUrl, fetchImpl }).createPr({\n head: 'lane-x',\n base: 'main',\n title: 't',\n body: 'b',\n });\n expect(calls[0].url).to.equal('https://api.github.com/repos/acme/shop/pulls');\n });\n });\n });\n\n it('a github.com repository always talks to api.github.com, whatever GITHUB_API_URL says', () => {\n process.env.GITHUB_API_URL = 'https://evil.example/api/v3';\n expect(gitHubApiUrl()).to.deep.equal({ url: 'https://api.github.com' });\n expect(gitHubApiUrl('github.com')).to.deep.equal({ url: 'https://api.github.com' });\n expect(GitHubClient.fromEnv('git@github.com:acme/shop.git')?.apiUrl).to.equal('https://api.github.com');\n });\n\n describe('on a GHES runner', () => {\n beforeEach(() => {\n process.env.GITHUB_API_URL = GHES_API;\n process.env.GITHUB_SERVER_URL = GHES_SERVER;\n });\n\n /** url, parseGitHubRepo, isGitHubRemote — the GHES host joins github.com, and nothing else does. */\n const GHES_REMOTES: Array<[string, string | undefined, boolean]> = [\n ['https://ghe.corp.example/acme/store.git', 'acme/store', true],\n ['https://ghe.corp.example/acme/store', 'acme/store', true],\n ['git@ghe.corp.example:acme/store.git', 'acme/store', true],\n ['ssh://git@ghe.corp.example/acme/store.git', 'acme/store', true],\n ['https://x-access-token:tok@GHE.corp.example:443/acme/store.git', 'acme/store', true],\n // github.com stays GitHub's on a GHES runner\n ['git@github.com:acme/shop.git', 'acme/shop', true],\n // the GHES host as a path segment, as a prefix of another host, or as userinfo is a look-alike\n ['https://evil.example/ghe.corp.example/x.git', undefined, false],\n ['https://ghe.corp.example.evil.com/x.git', undefined, false],\n ['git@evil.example:ghe.corp.example/x.git', undefined, false],\n ['https://ghe.corp.example@evil.example/acme/store.git', undefined, false],\n ['https://corp.example/acme/store.git', undefined, false],\n ];\n\n it('claims and parses GHES remotes, and still rejects every look-alike', () => {\n GHES_REMOTES.forEach(([url, repo, isGitHub]) => {\n expect(parseGitHubRepo(url), url).to.equal(repo);\n expect(isGitHubRemote(url), url).to.equal(isGitHub);\n });\n // the REMOTES table's verdicts hold unchanged alongside the GHES host\n REMOTES.forEach(([url, repo, isGitHub]) => {\n expect(parseGitHubRepo(url), url).to.equal(repo);\n expect(isGitHubRemote(url), url).to.equal(isGitHub);\n });\n });\n\n it('matchesRemote accepts the GHES remote in both url forms, and rejects look-alikes', () => {\n const client = new GitHubClient({ token: 'tok', repo: 'acme/store' });\n expect(client.matchesRemote('https://ghe.corp.example/acme/store.git')).to.equal(true);\n expect(client.matchesRemote('git@ghe.corp.example:acme/store.git')).to.equal(true);\n expect(client.matchesRemote('https://evil.example/ghe.corp.example/x.git')).to.equal(false);\n expect(client.matchesRemote('https://ghe.corp.example.evil.com/x.git')).to.equal(false);\n });\n\n it('sends every pull-request call to the GHES API base', async () => {\n const client = GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git');\n expect(client?.repo).to.equal('acme/store');\n expect(client?.apiUrl).to.equal(GHES_API);\n\n const { calls, fetchImpl } = recordingFetch(PR);\n const wired = new GitHubClient({ token: 'tok', repo: client!.repo, apiUrl: client!.apiUrl, fetchImpl });\n await wired.findPrByBranch('lane-x');\n await wired.createPr({ head: 'lane-x', base: 'main', title: 't', body: 'b' });\n await wired.addLabel(7, 'bit-sync-conflict');\n await wired.closePr(7, 'bye');\n expect(calls.map((c) => `${c.init.method} ${c.url}`)).to.deep.equal([\n 'GET https://ghe.corp.example/api/v3/repos/acme/store/pulls?state=open&head=acme%3Alane-x',\n 'POST https://ghe.corp.example/api/v3/repos/acme/store/pulls',\n 'POST https://ghe.corp.example/api/v3/repos/acme/store/issues/7/labels',\n 'POST https://ghe.corp.example/api/v3/repos/acme/store/issues/7/comments',\n 'PATCH https://ghe.corp.example/api/v3/repos/acme/store/pulls/7',\n ]);\n });\n\n it('uses the client built from the environment, with no fetch override, against the GHES base', async () => {\n const realFetch = globalThis.fetch;\n const { calls, fetchImpl } = recordingFetch();\n globalThis.fetch = fetchImpl;\n try {\n await GitHubClient.fromEnv('https://ghe.corp.example/acme/store.git')?.findPrByBranch('lane-x');\n } finally {\n globalThis.fetch = realFetch;\n }\n expect(calls).to.have.lengthOf(1);\n expect(calls[0].url).to.match(/^https:\\/\\/ghe\\.corp\\.example\\/api\\/v3\\/repos\\/acme\\/store\\/pulls\\?/);\n expect(calls[0].init.headers.authorization).to.equal('Bearer tok');\n });\n\n it('a github.com remote on a GHES runner still talks to api.github.com', () => {\n expect(GitHubClient.fromEnv('git@github.com:acme/shop.git')?.apiUrl).to.equal('https://api.github.com');\n expect(gitHubApiUrl('github.com')).to.deep.equal({ url: 'https://api.github.com' });\n expect(gitHubApiUrl('GHE.corp.example')).to.deep.equal({ url: GHES_API });\n expect(gitHubApiUrl()).to.deep.equal({ url: GHES_API });\n });\n\n it('without GITHUB_API_URL, derives the GHES convention <server origin>/api/v3 — never api.github.com', () => {\n delete process.env.GITHUB_API_URL;\n expect(gitHubApiUrl()).to.deep.equal({ url: GHES_API });\n expect(gitHubApiUrl('ghe.corp.example')).to.deep.equal({ url: GHES_API });\n expect(GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git')?.apiUrl).to.equal(GHES_API);\n // the server's protocol and port carry over; its path does not\n process.env.GITHUB_SERVER_URL = 'http://ghe.corp.example:8080/';\n expect(gitHubApiUrl('ghe.corp.example')).to.deep.equal({ url: 'http://ghe.corp.example:8080/api/v3' });\n // github.com is untouched by the enterprise default\n expect(gitHubApiUrl('github.com')).to.deep.equal({ url: 'https://api.github.com' });\n });\n\n it('accepts a GITHUB_API_URL on api.<server host> (GHE.com data residency)', () => {\n process.env.GITHUB_SERVER_URL = 'https://acme.ghe.com';\n process.env.GITHUB_API_URL = 'https://api.acme.ghe.com';\n expect(gitHubApiUrl('acme.ghe.com')).to.deep.equal({ url: 'https://api.acme.ghe.com' });\n expect(GitHubClient.fromEnv('https://acme.ghe.com/acme/store.git')?.apiUrl).to.equal('https://api.acme.ghe.com');\n });\n\n it('refuses a GITHUB_API_URL on another host: no client, a warning naming both values, no request', async () => {\n const MISMATCHED = [\n 'https://api.github.com',\n 'https://evil.example/api/v3',\n 'https://ghe.corp.example.evil.com/api/v3',\n 'https://api.ghe.corp.example.evil.com',\n 'not a url',\n ];\n for (const apiUrl of MISMATCHED) {\n process.env.GITHUB_API_URL = apiUrl;\n const result = gitHubApiUrl('ghe.corp.example');\n expect(result, apiUrl).to.not.have.property('url');\n expect((result as { error: string }).error, apiUrl)\n .to.contain(apiUrl)\n .and.contain(GHES_SERVER);\n\n const warnings: string[] = [];\n expect(\n GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git', (m) => warnings.push(m)),\n apiUrl\n ).to.equal(undefined);\n // a repository from GITHUB_REPOSITORY alone lives on the enterprise instance too\n process.env.GITHUB_REPOSITORY = 'acme/store';\n expect(\n GitHubClient.fromEnv(undefined, (m) => warnings.push(m)),\n apiUrl\n ).to.equal(undefined);\n delete process.env.GITHUB_REPOSITORY;\n expect(warnings, apiUrl).to.have.lengthOf(2);\n warnings.forEach((w) => expect(w, apiUrl).to.contain(`\"${apiUrl}\"`).and.contain(`\"${GHES_SERVER}\"`));\n\n // the provider reports \"not configured\", warns once across retries, and sends nothing\n const realFetch = globalThis.fetch;\n const { calls, fetchImpl } = recordingFetch();\n globalThis.fetch = fetchImpl;\n const providerWarnings: string[] = [];\n try {\n const provider = new GitHubHostProvider((m) => providerWarnings.push(m));\n expect(provider.isConfigured('git@ghe.corp.example:acme/store.git'), apiUrl).to.equal(false);\n expect(provider.isConfigured('git@ghe.corp.example:acme/store.git'), apiUrl).to.equal(false);\n let thrown: unknown;\n await provider.findPrByBranch('lane-x').catch((e) => {\n thrown = e;\n });\n expect(thrown, apiUrl).to.be.instanceOf(Error);\n } finally {\n globalThis.fetch = realFetch;\n }\n expect(calls, apiUrl).to.have.lengthOf(0);\n expect(providerWarnings, apiUrl).to.have.lengthOf(1);\n }\n // a github.com remote on the same misconfigured runner is unaffected\n expect(GitHubClient.fromEnv('git@github.com:acme/shop.git')?.apiUrl).to.equal('https://api.github.com');\n });\n\n it('never lets an https server hand its token to a plaintext or non-web API', () => {\n ['http://ghe.corp.example/api/v3', 'http://api.ghe.corp.example', 'ftp://ghe.corp.example/api/v3'].forEach(\n (apiUrl) => {\n process.env.GITHUB_API_URL = apiUrl;\n const result = gitHubApiUrl('ghe.corp.example');\n expect(result, apiUrl).to.not.have.property('url');\n expect((result as { error: string }).error, apiUrl)\n .to.contain(apiUrl)\n .and.contain('is not https');\n const warnings: string[] = [];\n expect(\n GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git', (m) => warnings.push(m)),\n apiUrl\n ).to.equal(undefined);\n expect(warnings, apiUrl).to.have.lengthOf(1);\n }\n );\n });\n\n it('lets an http server use an http or https API on its host, but no other protocol', () => {\n process.env.GITHUB_SERVER_URL = 'http://ghe.corp.example';\n process.env.GITHUB_API_URL = 'http://ghe.corp.example/api/v3';\n expect(gitHubApiUrl('ghe.corp.example')).to.deep.equal({ url: 'http://ghe.corp.example/api/v3' });\n process.env.GITHUB_API_URL = 'https://ghe.corp.example/api/v3';\n expect(gitHubApiUrl('ghe.corp.example')).to.deep.equal({ url: 'https://ghe.corp.example/api/v3' });\n process.env.GITHUB_API_URL = 'ftp://ghe.corp.example/api/v3';\n expect(gitHubApiUrl('ghe.corp.example')).to.not.have.property('url');\n // a non-web server URL derives no API at all\n delete process.env.GITHUB_API_URL;\n process.env.GITHUB_SERVER_URL = 'ftp://ghe.corp.example';\n expect(gitHubApiUrl('ghe.corp.example')).to.not.have.property('url');\n });\n\n it('refuses a GITHUB_API_URL with a query or fragment, which would swallow the request path', () => {\n ['https://ghe.corp.example/api/v3?x=1', 'https://ghe.corp.example/api/v3#frag'].forEach((apiUrl) => {\n process.env.GITHUB_API_URL = apiUrl;\n const result = gitHubApiUrl('ghe.corp.example');\n expect(result, apiUrl).to.not.have.property('url');\n expect((result as { error: string }).error, apiUrl)\n .to.contain(apiUrl)\n .and.contain('query or fragment');\n expect(GitHubClient.fromEnv('git@ghe.corp.example:acme/store.git'), apiUrl).to.equal(undefined);\n });\n });\n\n it('one provider reused for an enterprise origin and then a github.com origin talks to each one', async () => {\n const realFetch = globalThis.fetch;\n const { calls, fetchImpl } = recordingFetch();\n globalThis.fetch = fetchImpl;\n try {\n const provider = new GitHubHostProvider();\n // a PR call carries no remote: it follows the remote last selected\n expect(provider.matchesRemote('git@ghe.corp.example:acme/store.git')).to.equal(true);\n expect(provider.isConfigured('git@ghe.corp.example:acme/store.git')).to.equal(true);\n await provider.findPrByBranch('lane-x');\n expect(provider.isConfigured('git@github.com:acme/shop.git')).to.equal(true);\n await provider.findPrByBranch('lane-x');\n } finally {\n globalThis.fetch = realFetch;\n }\n expect(calls.map((c) => c.url)).to.deep.equal([\n `${GHES_API}/repos/acme/store/pulls?state=open&head=acme%3Alane-x`,\n 'https://api.github.com/repos/acme/shop/pulls?state=open&head=acme%3Alane-x',\n ]);\n });\n\n it('drops a trailing slash from GITHUB_API_URL', () => {\n process.env.GITHUB_API_URL = `${GHES_API}/`;\n expect(gitHubApiUrl()).to.deep.equal({ url: GHES_API });\n });\n\n it('follows pagination on the GHES API, and refuses a next link that leaves it', async () => {\n const calls: Array<{ url: string; init: any }> = [];\n const fetchImpl = (async (url: any, init: any) => {\n calls.push({ url: String(url), init });\n const page2 = String(url).includes('page=2');\n return new Response(JSON.stringify([{ id: page2 ? 2 : 1, body: 'unrelated' }]), {\n status: 200,\n headers: {\n 'content-type': 'application/json',\n link: page2\n ? '<https://api.github.com/repos/acme/store/issues/7/comments?page=3>; rel=\"next\"'\n : `<${GHES_API}/repos/acme/store/issues/7/comments?per_page=100&page=2>; rel=\"next\"`,\n },\n });\n }) as typeof fetch;\n const client = new GitHubClient({ token: 'tok', repo: 'acme/store', apiUrl: GHES_API, fetchImpl });\n await client.upsertComment(7, '<!-- marker -->', 'cleared', { createIfAbsent: false });\n expect(calls.map((c) => c.url)).to.deep.equal([\n `${GHES_API}/repos/acme/store/issues/7/comments?per_page=100`,\n `${GHES_API}/repos/acme/store/issues/7/comments?per_page=100&page=2`,\n ]);\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,cAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACA;AACA,MAAMG,OAAqD,GAAG;AAC5D;AACA,CAAC,8BAA8B,EAAE,WAAW,EAA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,8 @@ export declare function scaffoldWorkflowFiles(workspaceDir: string, defaultBranc
26
26
  export interface OwnerRepo {
27
27
  owner: string;
28
28
  repo: string;
29
+ /** The remote's host — github.com or the GITHUB_SERVER_URL one — which picks the API the checklist names. */
30
+ host: string;
29
31
  }
30
32
  /**
31
33
  * Derive `{owner, repo}` from the `origin` remote when it is a parseable GitHub remote, else