@@ -416,10 +416,15 @@ function getIDToken(aud) {
416
416
}
417
417
exports.getIDToken = getIDToken;
418
418
/**
419
- * Markdown summary exports
419
+ * Summary exports
420
420
*/
421
- var markdown_summary_1 = __nccwpck_require__(8042);
422
- Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return markdown_summary_1.markdownSummary; } }));
421
+ var summary_1 = __nccwpck_require__(1327);
422
+ Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } }));
423
+ /**
424
+ * @deprecated use core.summary
425
+ */
426
+ var summary_2 = __nccwpck_require__(1327);
427
+ Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
423
428
//# sourceMappingURL=core.js.map
424
429
425
430
/***/ }),
@@ -473,7 +478,91 @@ exports.issueCommand = issueCommand;
473
478
474
479
/***/ }),
475
480
476
- /***/ 8042:
481
+ /***/ 8041:
482
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
483
+
484
+ "use strict";
485
+
486
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
487
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
488
+ return new (P || (P = Promise))(function (resolve, reject) {
489
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
490
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
491
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
492
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
493
+ });
494
+ };
495
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
496
+ exports.OidcClient = void 0;
497
+ const http_client_1 = __nccwpck_require__(9925);
498
+ const auth_1 = __nccwpck_require__(3702);
499
+ const core_1 = __nccwpck_require__(2186);
500
+ class OidcClient {
501
+ static createHttpClient(allowRetry = true, maxRetry = 10) {
502
+ const requestOptions = {
503
+ allowRetries: allowRetry,
504
+ maxRetries: maxRetry
505
+ };
506
+ return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
507
+ }
508
+ static getRequestToken() {
509
+ const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
510
+ if (!token) {
511
+ throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
512
+ }
513
+ return token;
514
+ }
515
+ static getIDTokenUrl() {
516
+ const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
517
+ if (!runtimeUrl) {
518
+ throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
519
+ }
520
+ return runtimeUrl;
521
+ }
522
+ static getCall(id_token_url) {
523
+ var _a;
524
+ return __awaiter(this, void 0, void 0, function* () {
525
+ const httpclient = OidcClient.createHttpClient();
526
+ const res = yield httpclient
527
+ .getJson(id_token_url)
528
+ .catch(error => {
529
+ throw new Error(`Failed to get ID Token. \n
530
+ Error Code : ${error.statusCode}\n
531
+ Error Message: ${error.result.message}`);
532
+ });
533
+ const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
534
+ if (!id_token) {
535
+ throw new Error('Response json body do not have ID Token field');
536
+ }
537
+ return id_token;
538
+ });
539
+ }
540
+ static getIDToken(audience) {
541
+ return __awaiter(this, void 0, void 0, function* () {
542
+ try {
543
+ // New ID Token is requested from action service
544
+ let id_token_url = OidcClient.getIDTokenUrl();
545
+ if (audience) {
546
+ const encodedAudience = encodeURIComponent(audience);
547
+ id_token_url = `${id_token_url}&audience=${encodedAudience}`;
548
+ }
549
+ core_1.debug(`ID token url is ${id_token_url}`);
550
+ const id_token = yield OidcClient.getCall(id_token_url);
551
+ core_1.setSecret(id_token);
552
+ return id_token;
553
+ }
554
+ catch (error) {
555
+ throw new Error(`Error message: ${error.message}`);
556
+ }
557
+ });
558
+ }
559
+ }
560
+ exports.OidcClient = OidcClient;
561
+ //# sourceMappingURL=oidc-utils.js.map
562
+
563
+ /***/ }),
564
+
565
+ /***/ 1327:
477
566
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
478
567
479
568
"use strict";
@@ -488,13 +577,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
488
577
});
489
578
};
490
579
Object.defineProperty(exports, "__esModule", ({ value: true }));
491
- exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
580
+ exports.summary = exports. markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
492
581
const os_1 = __nccwpck_require__(2037);
493
582
const fs_1 = __nccwpck_require__(7147);
494
583
const { access, appendFile, writeFile } = fs_1.promises;
495
584
exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
496
- exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown -summary';
497
- class MarkdownSummary {
585
+ exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job -summary';
586
+ class Summary {
498
587
constructor() {
499
588
this._buffer = '';
500
589
}
@@ -511,7 +600,7 @@ class MarkdownSummary {
511
600
}
512
601
const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
513
602
if (!pathFromEnv) {
514
- throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports markdown summaries.`);
603
+ throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
515
604
}
516
605
try {
517
606
yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
@@ -546,7 +635,7 @@ class MarkdownSummary {
546
635
*
547
636
* @param {SummaryWriteOptions} [options] (optional) options for write operation
548
637
*
549
- * @returns {Promise<MarkdownSummary>} markdown summary instance
638
+ * @returns {Promise<Summary>} summary instance
550
639
*/
551
640
write(options) {
552
641
return __awaiter(this, void 0, void 0, function* () {
@@ -560,7 +649,7 @@ class MarkdownSummary {
560
649
/**
561
650
* Clears the summary buffer and wipes the summary file
562
651
*
563
- * @returns {MarkdownSummary} markdown summary instance
652
+ * @returns {Summary} summary instance
564
653
*/
565
654
clear() {
566
655
return __awaiter(this, void 0, void 0, function* () {
@@ -586,7 +675,7 @@ class MarkdownSummary {
586
675
/**
587
676
* Resets the summary buffer without writing to summary file
588
677
*
589
- * @returns {MarkdownSummary} markdown summary instance
678
+ * @returns {Summary} summary instance
590
679
*/
591
680
emptyBuffer() {
592
681
this._buffer = '';
@@ -598,7 +687,7 @@ class MarkdownSummary {
598
687
* @param {string} text content to add
599
688
* @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
600
689
*
601
- * @returns {MarkdownSummary} markdown summary instance
690
+ * @returns {Summary} summary instance
602
691
*/
603
692
addRaw(text, addEOL = false) {
604
693
this._buffer += text;
@@ -607,7 +696,7 @@ class MarkdownSummary {
607
696
/**
608
697
* Adds the operating system-specific end-of-line marker to the buffer
609
698
*
610
- * @returns {MarkdownSummary} markdown summary instance
699
+ * @returns {Summary} summary instance
611
700
*/
612
701
addEOL() {
613
702
return this.addRaw(os_1.EOL);
@@ -618,7 +707,7 @@ class MarkdownSummary {
618
707
* @param {string} code content to render within fenced code block
619
708
* @param {string} lang (optional) language to syntax highlight code
620
709
*
621
- * @returns {MarkdownSummary} markdown summary instance
710
+ * @returns {Summary} summary instance
622
711
*/
623
712
addCodeBlock(code, lang) {
624
713
const attrs = Object.assign({}, (lang && { lang }));
@@ -631,7 +720,7 @@ class MarkdownSummary {
631
720
* @param {string[]} items list of items to render
632
721
* @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
633
722
*
634
- * @returns {MarkdownSummary} markdown summary instance
723
+ * @returns {Summary} summary instance
635
724
*/
636
725
addList(items, ordered = false) {
637
726
const tag = ordered ? 'ol' : 'ul';
@@ -644,7 +733,7 @@ class MarkdownSummary {
644
733
*
645
734
* @param {SummaryTableCell[]} rows table rows
646
735
*
647
- * @returns {MarkdownSummary} markdown summary instance
736
+ * @returns {Summary} summary instance
648
737
*/
649
738
addTable(rows) {
650
739
const tableBody = rows
@@ -672,7 +761,7 @@ class MarkdownSummary {
672
761
* @param {string} label text for the closed state
673
762
* @param {string} content collapsable content
674
763
*
675
- * @returns {MarkdownSummary} markdown summary instance
764
+ * @returns {Summary} summary instance
676
765
*/
677
766
addDetails(label, content) {
678
767
const element = this.wrap('details', this.wrap('summary', label) + content);
@@ -685,7 +774,7 @@ class MarkdownSummary {
685
774
* @param {string} alt text description of the image
686
775
* @param {SummaryImageOptions} options (optional) addition image attributes
687
776
*
688
- * @returns {MarkdownSummary} markdown summary instance
777
+ * @returns {Summary} summary instance
689
778
*/
690
779
addImage(src, alt, options) {
691
780
const { width, height } = options || {};
@@ -699,7 +788,7 @@ class MarkdownSummary {
699
788
* @param {string} text heading text
700
789
* @param {number | string} [level=1] (optional) the heading level, default: 1
701
790
*
702
- * @returns {MarkdownSummary} markdown summary instance
791
+ * @returns {Summary} summary instance
703
792
*/
704
793
addHeading(text, level) {
705
794
const tag = `h${level}`;
@@ -712,7 +801,7 @@ class MarkdownSummary {
712
801
/**
713
802
* Adds an HTML thematic break (<hr>) to the summary buffer
714
803
*
715
- * @returns {MarkdownSummary} markdown summary instance
804
+ * @returns {Summary} summary instance
716
805
*/
717
806
addSeparator() {
718
807
const element = this.wrap('hr', null);
@@ -721,7 +810,7 @@ class MarkdownSummary {
721
810
/**
722
811
* Adds an HTML line break (<br>) to the summary buffer
723
812
*
724
- * @returns {MarkdownSummary} markdown summary instance
813
+ * @returns {Summary} summary instance
725
814
*/
726
815
addBreak() {
727
816
const element = this.wrap('br', null);
@@ -733,7 +822,7 @@ class MarkdownSummary {
733
822
* @param {string} text quote text
734
823
* @param {string} cite (optional) citation url
735
824
*
736
- * @returns {MarkdownSummary} markdown summary instance
825
+ * @returns {Summary} summary instance
737
826
*/
738
827
addQuote(text, cite) {
739
828
const attrs = Object.assign({}, (cite && { cite }));
@@ -746,100 +835,20 @@ class MarkdownSummary {
746
835
* @param {string} text link text/content
747
836
* @param {string} href hyperlink
748
837
*
749
- * @returns {MarkdownSummary} markdown summary instance
838
+ * @returns {Summary} summary instance
750
839
*/
751
840
addLink(text, href) {
752
841
const element = this.wrap('a', text, { href });
753
842
return this.addRaw(element).addEOL();
754
843
}
755
844
}
756
- // singleton export
757
- exports.markdownSummary = new MarkdownSummary();
758
- //# sourceMappingURL=markdown-summary.js.map
759
-
760
- /***/ }),
761
-
762
- /***/ 8041:
763
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
764
-
765
- "use strict";
766
-
767
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
768
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
769
- return new (P || (P = Promise))(function (resolve, reject) {
770
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
771
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
772
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
773
- step((generator = generator.apply(thisArg, _arguments || [])).next());
774
- });
775
- };
776
- Object.defineProperty(exports, "__esModule", ({ value: true }));
777
- exports.OidcClient = void 0;
778
- const http_client_1 = __nccwpck_require__(9925);
779
- const auth_1 = __nccwpck_require__(3702);
780
- const core_1 = __nccwpck_require__(2186);
781
- class OidcClient {
782
- static createHttpClient(allowRetry = true, maxRetry = 10) {
783
- const requestOptions = {
784
- allowRetries: allowRetry,
785
- maxRetries: maxRetry
786
- };
787
- return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
788
- }
789
- static getRequestToken() {
790
- const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
791
- if (!token) {
792
- throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
793
- }
794
- return token;
795
- }
796
- static getIDTokenUrl() {
797
- const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
798
- if (!runtimeUrl) {
799
- throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
800
- }
801
- return runtimeUrl;
802
- }
803
- static getCall(id_token_url) {
804
- var _a;
805
- return __awaiter(this, void 0, void 0, function* () {
806
- const httpclient = OidcClient.createHttpClient();
807
- const res = yield httpclient
808
- .getJson(id_token_url)
809
- .catch(error => {
810
- throw new Error(`Failed to get ID Token. \n
811
- Error Code : ${error.statusCode}\n
812
- Error Message: ${error.result.message}`);
813
- });
814
- const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
815
- if (!id_token) {
816
- throw new Error('Response json body do not have ID Token field');
817
- }
818
- return id_token;
819
- });
820
- }
821
- static getIDToken(audience) {
822
- return __awaiter(this, void 0, void 0, function* () {
823
- try {
824
- // New ID Token is requested from action service
825
- let id_token_url = OidcClient.getIDTokenUrl();
826
- if (audience) {
827
- const encodedAudience = encodeURIComponent(audience);
828
- id_token_url = `${id_token_url}&audience=${encodedAudience}`;
829
- }
830
- core_1.debug(`ID token url is ${id_token_url}`);
831
- const id_token = yield OidcClient.getCall(id_token_url);
832
- core_1.setSecret(id_token);
833
- return id_token;
834
- }
835
- catch (error) {
836
- throw new Error(`Error message: ${error.message}`);
837
- }
838
- });
839
- }
840
- }
841
- exports.OidcClient = OidcClient;
842
- //# sourceMappingURL=oidc-utils.js.map
845
+ const _summary = new Summary();
846
+ /**
847
+ * @deprecated use `core.summary`
848
+ */
849
+ exports.markdownSummary = _summary;
850
+ exports.summary = _summary;
851
+ //# sourceMappingURL=summary.js.map
843
852
844
853
/***/ }),
845
854
0 commit comments