@@ -3813,6 +3813,16 @@ function getIDToken(aud) {
38133813 });
38143814}
38153815exports.getIDToken = getIDToken;
3816+ /**
3817+ * Summary exports
3818+ */
3819+ var summary_1 = __webpack_require__(327);
3820+ Object.defineProperty(exports, "summary", { enumerable: true, get: function () { return summary_1.summary; } });
3821+ /**
3822+ * @deprecated use core.summary
3823+ */
3824+ var summary_2 = __webpack_require__(327);
3825+ Object.defineProperty(exports, "markdownSummary", { enumerable: true, get: function () { return summary_2.markdownSummary; } });
38163826//# sourceMappingURL=core.js.map
38173827
38183828/***/ }),
@@ -5479,6 +5489,296 @@ exports.serializeInteger = __webpack_require__(33).serializeInteger;
54795489exports.parseURL = __webpack_require__(33).parseURL;
54805490
54815491
5492+ /***/ }),
5493+
5494+ /***/ 327:
5495+ /***/ (function(__unusedmodule, exports, __webpack_require__) {
5496+
5497+ "use strict";
5498+
5499+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5500+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5501+ return new (P || (P = Promise))(function (resolve, reject) {
5502+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5503+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5504+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5505+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5506+ });
5507+ };
5508+ Object.defineProperty(exports, "__esModule", { value: true });
5509+ exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
5510+ const os_1 = __webpack_require__(87);
5511+ const fs_1 = __webpack_require__(747);
5512+ const { access, appendFile, writeFile } = fs_1.promises;
5513+ exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
5514+ exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
5515+ class Summary {
5516+ constructor() {
5517+ this._buffer = '';
5518+ }
5519+ /**
5520+ * Finds the summary file path from the environment, rejects if env var is not found or file does not exist
5521+ * Also checks r/w permissions.
5522+ *
5523+ * @returns step summary file path
5524+ */
5525+ filePath() {
5526+ return __awaiter(this, void 0, void 0, function* () {
5527+ if (this._filePath) {
5528+ return this._filePath;
5529+ }
5530+ const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
5531+ if (!pathFromEnv) {
5532+ throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
5533+ }
5534+ try {
5535+ yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
5536+ }
5537+ catch (_a) {
5538+ throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
5539+ }
5540+ this._filePath = pathFromEnv;
5541+ return this._filePath;
5542+ });
5543+ }
5544+ /**
5545+ * Wraps content in an HTML tag, adding any HTML attributes
5546+ *
5547+ * @param {string} tag HTML tag to wrap
5548+ * @param {string | null} content content within the tag
5549+ * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
5550+ *
5551+ * @returns {string} content wrapped in HTML element
5552+ */
5553+ wrap(tag, content, attrs = {}) {
5554+ const htmlAttrs = Object.entries(attrs)
5555+ .map(([key, value]) => ` ${key}="${value}"`)
5556+ .join('');
5557+ if (!content) {
5558+ return `<${tag}${htmlAttrs}>`;
5559+ }
5560+ return `<${tag}${htmlAttrs}>${content}</${tag}>`;
5561+ }
5562+ /**
5563+ * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
5564+ *
5565+ * @param {SummaryWriteOptions} [options] (optional) options for write operation
5566+ *
5567+ * @returns {Promise<Summary>} summary instance
5568+ */
5569+ write(options) {
5570+ return __awaiter(this, void 0, void 0, function* () {
5571+ const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
5572+ const filePath = yield this.filePath();
5573+ const writeFunc = overwrite ? writeFile : appendFile;
5574+ yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
5575+ return this.emptyBuffer();
5576+ });
5577+ }
5578+ /**
5579+ * Clears the summary buffer and wipes the summary file
5580+ *
5581+ * @returns {Summary} summary instance
5582+ */
5583+ clear() {
5584+ return __awaiter(this, void 0, void 0, function* () {
5585+ return this.emptyBuffer().write({ overwrite: true });
5586+ });
5587+ }
5588+ /**
5589+ * Returns the current summary buffer as a string
5590+ *
5591+ * @returns {string} string of summary buffer
5592+ */
5593+ stringify() {
5594+ return this._buffer;
5595+ }
5596+ /**
5597+ * If the summary buffer is empty
5598+ *
5599+ * @returns {boolen} true if the buffer is empty
5600+ */
5601+ isEmptyBuffer() {
5602+ return this._buffer.length === 0;
5603+ }
5604+ /**
5605+ * Resets the summary buffer without writing to summary file
5606+ *
5607+ * @returns {Summary} summary instance
5608+ */
5609+ emptyBuffer() {
5610+ this._buffer = '';
5611+ return this;
5612+ }
5613+ /**
5614+ * Adds raw text to the summary buffer
5615+ *
5616+ * @param {string} text content to add
5617+ * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
5618+ *
5619+ * @returns {Summary} summary instance
5620+ */
5621+ addRaw(text, addEOL = false) {
5622+ this._buffer += text;
5623+ return addEOL ? this.addEOL() : this;
5624+ }
5625+ /**
5626+ * Adds the operating system-specific end-of-line marker to the buffer
5627+ *
5628+ * @returns {Summary} summary instance
5629+ */
5630+ addEOL() {
5631+ return this.addRaw(os_1.EOL);
5632+ }
5633+ /**
5634+ * Adds an HTML codeblock to the summary buffer
5635+ *
5636+ * @param {string} code content to render within fenced code block
5637+ * @param {string} lang (optional) language to syntax highlight code
5638+ *
5639+ * @returns {Summary} summary instance
5640+ */
5641+ addCodeBlock(code, lang) {
5642+ const attrs = Object.assign({}, (lang && { lang }));
5643+ const element = this.wrap('pre', this.wrap('code', code), attrs);
5644+ return this.addRaw(element).addEOL();
5645+ }
5646+ /**
5647+ * Adds an HTML list to the summary buffer
5648+ *
5649+ * @param {string[]} items list of items to render
5650+ * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
5651+ *
5652+ * @returns {Summary} summary instance
5653+ */
5654+ addList(items, ordered = false) {
5655+ const tag = ordered ? 'ol' : 'ul';
5656+ const listItems = items.map(item => this.wrap('li', item)).join('');
5657+ const element = this.wrap(tag, listItems);
5658+ return this.addRaw(element).addEOL();
5659+ }
5660+ /**
5661+ * Adds an HTML table to the summary buffer
5662+ *
5663+ * @param {SummaryTableCell[]} rows table rows
5664+ *
5665+ * @returns {Summary} summary instance
5666+ */
5667+ addTable(rows) {
5668+ const tableBody = rows
5669+ .map(row => {
5670+ const cells = row
5671+ .map(cell => {
5672+ if (typeof cell === 'string') {
5673+ return this.wrap('td', cell);
5674+ }
5675+ const { header, data, colspan, rowspan } = cell;
5676+ const tag = header ? 'th' : 'td';
5677+ const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
5678+ return this.wrap(tag, data, attrs);
5679+ })
5680+ .join('');
5681+ return this.wrap('tr', cells);
5682+ })
5683+ .join('');
5684+ const element = this.wrap('table', tableBody);
5685+ return this.addRaw(element).addEOL();
5686+ }
5687+ /**
5688+ * Adds a collapsable HTML details element to the summary buffer
5689+ *
5690+ * @param {string} label text for the closed state
5691+ * @param {string} content collapsable content
5692+ *
5693+ * @returns {Summary} summary instance
5694+ */
5695+ addDetails(label, content) {
5696+ const element = this.wrap('details', this.wrap('summary', label) + content);
5697+ return this.addRaw(element).addEOL();
5698+ }
5699+ /**
5700+ * Adds an HTML image tag to the summary buffer
5701+ *
5702+ * @param {string} src path to the image you to embed
5703+ * @param {string} alt text description of the image
5704+ * @param {SummaryImageOptions} options (optional) addition image attributes
5705+ *
5706+ * @returns {Summary} summary instance
5707+ */
5708+ addImage(src, alt, options) {
5709+ const { width, height } = options || {};
5710+ const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
5711+ const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
5712+ return this.addRaw(element).addEOL();
5713+ }
5714+ /**
5715+ * Adds an HTML section heading element
5716+ *
5717+ * @param {string} text heading text
5718+ * @param {number | string} [level=1] (optional) the heading level, default: 1
5719+ *
5720+ * @returns {Summary} summary instance
5721+ */
5722+ addHeading(text, level) {
5723+ const tag = `h${level}`;
5724+ const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
5725+ ? tag
5726+ : 'h1';
5727+ const element = this.wrap(allowedTag, text);
5728+ return this.addRaw(element).addEOL();
5729+ }
5730+ /**
5731+ * Adds an HTML thematic break (<hr>) to the summary buffer
5732+ *
5733+ * @returns {Summary} summary instance
5734+ */
5735+ addSeparator() {
5736+ const element = this.wrap('hr', null);
5737+ return this.addRaw(element).addEOL();
5738+ }
5739+ /**
5740+ * Adds an HTML line break (<br>) to the summary buffer
5741+ *
5742+ * @returns {Summary} summary instance
5743+ */
5744+ addBreak() {
5745+ const element = this.wrap('br', null);
5746+ return this.addRaw(element).addEOL();
5747+ }
5748+ /**
5749+ * Adds an HTML blockquote to the summary buffer
5750+ *
5751+ * @param {string} text quote text
5752+ * @param {string} cite (optional) citation url
5753+ *
5754+ * @returns {Summary} summary instance
5755+ */
5756+ addQuote(text, cite) {
5757+ const attrs = Object.assign({}, (cite && { cite }));
5758+ const element = this.wrap('blockquote', text, attrs);
5759+ return this.addRaw(element).addEOL();
5760+ }
5761+ /**
5762+ * Adds an HTML anchor tag to the summary buffer
5763+ *
5764+ * @param {string} text link text/content
5765+ * @param {string} href hyperlink
5766+ *
5767+ * @returns {Summary} summary instance
5768+ */
5769+ addLink(text, href) {
5770+ const element = this.wrap('a', text, { href });
5771+ return this.addRaw(element).addEOL();
5772+ }
5773+ }
5774+ const _summary = new Summary();
5775+ /**
5776+ * @deprecated use `core.summary`
5777+ */
5778+ exports.markdownSummary = _summary;
5779+ exports.summary = _summary;
5780+ //# sourceMappingURL=summary.js.map
5781+
54825782/***/ }),
54835783
54845784/***/ 334:
0 commit comments