@@ -1643,6 +1643,16 @@ function getIDToken(aud) {
1643
1643
});
1644
1644
}
1645
1645
exports.getIDToken = getIDToken;
1646
+ /**
1647
+ * Summary exports
1648
+ */
1649
+ var summary_1 = __nccwpck_require__(1327);
1650
+ Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } }));
1651
+ /**
1652
+ * @deprecated use core.summary
1653
+ */
1654
+ var summary_2 = __nccwpck_require__(1327);
1655
+ Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
1646
1656
//# sourceMappingURL=core.js.map
1647
1657
1648
1658
/***/ }),
@@ -1780,6 +1790,296 @@ exports.OidcClient = OidcClient;
1780
1790
1781
1791
/***/ }),
1782
1792
1793
+ /***/ 1327:
1794
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1795
+
1796
+ "use strict";
1797
+
1798
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1799
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1800
+ return new (P || (P = Promise))(function (resolve, reject) {
1801
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1802
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1803
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1804
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1805
+ });
1806
+ };
1807
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1808
+ exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
1809
+ const os_1 = __nccwpck_require__(2037);
1810
+ const fs_1 = __nccwpck_require__(7147);
1811
+ const { access, appendFile, writeFile } = fs_1.promises;
1812
+ exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
1813
+ exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
1814
+ class Summary {
1815
+ constructor() {
1816
+ this._buffer = '';
1817
+ }
1818
+ /**
1819
+ * Finds the summary file path from the environment, rejects if env var is not found or file does not exist
1820
+ * Also checks r/w permissions.
1821
+ *
1822
+ * @returns step summary file path
1823
+ */
1824
+ filePath() {
1825
+ return __awaiter(this, void 0, void 0, function* () {
1826
+ if (this._filePath) {
1827
+ return this._filePath;
1828
+ }
1829
+ const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
1830
+ if (!pathFromEnv) {
1831
+ throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
1832
+ }
1833
+ try {
1834
+ yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
1835
+ }
1836
+ catch (_a) {
1837
+ throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
1838
+ }
1839
+ this._filePath = pathFromEnv;
1840
+ return this._filePath;
1841
+ });
1842
+ }
1843
+ /**
1844
+ * Wraps content in an HTML tag, adding any HTML attributes
1845
+ *
1846
+ * @param {string} tag HTML tag to wrap
1847
+ * @param {string | null} content content within the tag
1848
+ * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
1849
+ *
1850
+ * @returns {string} content wrapped in HTML element
1851
+ */
1852
+ wrap(tag, content, attrs = {}) {
1853
+ const htmlAttrs = Object.entries(attrs)
1854
+ .map(([key, value]) => ` ${key}="${value}"`)
1855
+ .join('');
1856
+ if (!content) {
1857
+ return `<${tag}${htmlAttrs}>`;
1858
+ }
1859
+ return `<${tag}${htmlAttrs}>${content}</${tag}>`;
1860
+ }
1861
+ /**
1862
+ * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
1863
+ *
1864
+ * @param {SummaryWriteOptions} [options] (optional) options for write operation
1865
+ *
1866
+ * @returns {Promise<Summary>} summary instance
1867
+ */
1868
+ write(options) {
1869
+ return __awaiter(this, void 0, void 0, function* () {
1870
+ const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
1871
+ const filePath = yield this.filePath();
1872
+ const writeFunc = overwrite ? writeFile : appendFile;
1873
+ yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
1874
+ return this.emptyBuffer();
1875
+ });
1876
+ }
1877
+ /**
1878
+ * Clears the summary buffer and wipes the summary file
1879
+ *
1880
+ * @returns {Summary} summary instance
1881
+ */
1882
+ clear() {
1883
+ return __awaiter(this, void 0, void 0, function* () {
1884
+ return this.emptyBuffer().write({ overwrite: true });
1885
+ });
1886
+ }
1887
+ /**
1888
+ * Returns the current summary buffer as a string
1889
+ *
1890
+ * @returns {string} string of summary buffer
1891
+ */
1892
+ stringify() {
1893
+ return this._buffer;
1894
+ }
1895
+ /**
1896
+ * If the summary buffer is empty
1897
+ *
1898
+ * @returns {boolen} true if the buffer is empty
1899
+ */
1900
+ isEmptyBuffer() {
1901
+ return this._buffer.length === 0;
1902
+ }
1903
+ /**
1904
+ * Resets the summary buffer without writing to summary file
1905
+ *
1906
+ * @returns {Summary} summary instance
1907
+ */
1908
+ emptyBuffer() {
1909
+ this._buffer = '';
1910
+ return this;
1911
+ }
1912
+ /**
1913
+ * Adds raw text to the summary buffer
1914
+ *
1915
+ * @param {string} text content to add
1916
+ * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
1917
+ *
1918
+ * @returns {Summary} summary instance
1919
+ */
1920
+ addRaw(text, addEOL = false) {
1921
+ this._buffer += text;
1922
+ return addEOL ? this.addEOL() : this;
1923
+ }
1924
+ /**
1925
+ * Adds the operating system-specific end-of-line marker to the buffer
1926
+ *
1927
+ * @returns {Summary} summary instance
1928
+ */
1929
+ addEOL() {
1930
+ return this.addRaw(os_1.EOL);
1931
+ }
1932
+ /**
1933
+ * Adds an HTML codeblock to the summary buffer
1934
+ *
1935
+ * @param {string} code content to render within fenced code block
1936
+ * @param {string} lang (optional) language to syntax highlight code
1937
+ *
1938
+ * @returns {Summary} summary instance
1939
+ */
1940
+ addCodeBlock(code, lang) {
1941
+ const attrs = Object.assign({}, (lang && { lang }));
1942
+ const element = this.wrap('pre', this.wrap('code', code), attrs);
1943
+ return this.addRaw(element).addEOL();
1944
+ }
1945
+ /**
1946
+ * Adds an HTML list to the summary buffer
1947
+ *
1948
+ * @param {string[]} items list of items to render
1949
+ * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
1950
+ *
1951
+ * @returns {Summary} summary instance
1952
+ */
1953
+ addList(items, ordered = false) {
1954
+ const tag = ordered ? 'ol' : 'ul';
1955
+ const listItems = items.map(item => this.wrap('li', item)).join('');
1956
+ const element = this.wrap(tag, listItems);
1957
+ return this.addRaw(element).addEOL();
1958
+ }
1959
+ /**
1960
+ * Adds an HTML table to the summary buffer
1961
+ *
1962
+ * @param {SummaryTableCell[]} rows table rows
1963
+ *
1964
+ * @returns {Summary} summary instance
1965
+ */
1966
+ addTable(rows) {
1967
+ const tableBody = rows
1968
+ .map(row => {
1969
+ const cells = row
1970
+ .map(cell => {
1971
+ if (typeof cell === 'string') {
1972
+ return this.wrap('td', cell);
1973
+ }
1974
+ const { header, data, colspan, rowspan } = cell;
1975
+ const tag = header ? 'th' : 'td';
1976
+ const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
1977
+ return this.wrap(tag, data, attrs);
1978
+ })
1979
+ .join('');
1980
+ return this.wrap('tr', cells);
1981
+ })
1982
+ .join('');
1983
+ const element = this.wrap('table', tableBody);
1984
+ return this.addRaw(element).addEOL();
1985
+ }
1986
+ /**
1987
+ * Adds a collapsable HTML details element to the summary buffer
1988
+ *
1989
+ * @param {string} label text for the closed state
1990
+ * @param {string} content collapsable content
1991
+ *
1992
+ * @returns {Summary} summary instance
1993
+ */
1994
+ addDetails(label, content) {
1995
+ const element = this.wrap('details', this.wrap('summary', label) + content);
1996
+ return this.addRaw(element).addEOL();
1997
+ }
1998
+ /**
1999
+ * Adds an HTML image tag to the summary buffer
2000
+ *
2001
+ * @param {string} src path to the image you to embed
2002
+ * @param {string} alt text description of the image
2003
+ * @param {SummaryImageOptions} options (optional) addition image attributes
2004
+ *
2005
+ * @returns {Summary} summary instance
2006
+ */
2007
+ addImage(src, alt, options) {
2008
+ const { width, height } = options || {};
2009
+ const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
2010
+ const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
2011
+ return this.addRaw(element).addEOL();
2012
+ }
2013
+ /**
2014
+ * Adds an HTML section heading element
2015
+ *
2016
+ * @param {string} text heading text
2017
+ * @param {number | string} [level=1] (optional) the heading level, default: 1
2018
+ *
2019
+ * @returns {Summary} summary instance
2020
+ */
2021
+ addHeading(text, level) {
2022
+ const tag = `h${level}`;
2023
+ const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
2024
+ ? tag
2025
+ : 'h1';
2026
+ const element = this.wrap(allowedTag, text);
2027
+ return this.addRaw(element).addEOL();
2028
+ }
2029
+ /**
2030
+ * Adds an HTML thematic break (<hr>) to the summary buffer
2031
+ *
2032
+ * @returns {Summary} summary instance
2033
+ */
2034
+ addSeparator() {
2035
+ const element = this.wrap('hr', null);
2036
+ return this.addRaw(element).addEOL();
2037
+ }
2038
+ /**
2039
+ * Adds an HTML line break (<br>) to the summary buffer
2040
+ *
2041
+ * @returns {Summary} summary instance
2042
+ */
2043
+ addBreak() {
2044
+ const element = this.wrap('br', null);
2045
+ return this.addRaw(element).addEOL();
2046
+ }
2047
+ /**
2048
+ * Adds an HTML blockquote to the summary buffer
2049
+ *
2050
+ * @param {string} text quote text
2051
+ * @param {string} cite (optional) citation url
2052
+ *
2053
+ * @returns {Summary} summary instance
2054
+ */
2055
+ addQuote(text, cite) {
2056
+ const attrs = Object.assign({}, (cite && { cite }));
2057
+ const element = this.wrap('blockquote', text, attrs);
2058
+ return this.addRaw(element).addEOL();
2059
+ }
2060
+ /**
2061
+ * Adds an HTML anchor tag to the summary buffer
2062
+ *
2063
+ * @param {string} text link text/content
2064
+ * @param {string} href hyperlink
2065
+ *
2066
+ * @returns {Summary} summary instance
2067
+ */
2068
+ addLink(text, href) {
2069
+ const element = this.wrap('a', text, { href });
2070
+ return this.addRaw(element).addEOL();
2071
+ }
2072
+ }
2073
+ const _summary = new Summary();
2074
+ /**
2075
+ * @deprecated use `core.summary`
2076
+ */
2077
+ exports.markdownSummary = _summary;
2078
+ exports.summary = _summary;
2079
+ //# sourceMappingURL=summary.js.map
2080
+
2081
+ /***/ }),
2082
+
1783
2083
/***/ 5278:
1784
2084
/***/ ((__unused_webpack_module, exports) => {
1785
2085
0 commit comments