diff --git a/CHANGELOG.md b/CHANGELOG.md index a09238cc..550cd3e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [v1.17.15] - 2022-05-09 + +[Release notes](https://github.com/betahuhn/repo-file-sync-action/releases/tag/v1.17.15) · [Compare](https://github.com/betahuhn/repo-file-sync-action/compare/v1.17.14...v1.17.15) · [Tag](https://github.com/betahuhn/repo-file-sync-action/tree/v1.17.15) · Archive ([zip](https://github.com/betahuhn/repo-file-sync-action/archive/v1.17.15.zip) · [tar.gz](https://github.com/betahuhn/repo-file-sync-action/archive/v1.17.15.tar.gz)) + +### Dependency updates + +- [`b3c326d`](https://github.com/betahuhn/repo-file-sync-action/commit/b3c326d) Bump @actions/core from 1.7.0 to 1.8.0 + ## [v1.17.14] - 2022-05-05 [Release notes](https://github.com/betahuhn/repo-file-sync-action/releases/tag/v1.17.14) · [Compare](https://github.com/betahuhn/repo-file-sync-action/compare/v1.17.13...v1.17.14) · [Tag](https://github.com/betahuhn/repo-file-sync-action/tree/v1.17.14) · Archive ([zip](https://github.com/betahuhn/repo-file-sync-action/archive/v1.17.14.zip) · [tar.gz](https://github.com/betahuhn/repo-file-sync-action/archive/v1.17.14.tar.gz)) diff --git a/dist/index.js b/dist/index.js index dc4e93bc..6742ca4b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -416,10 +416,15 @@ function getIDToken(aud) { } exports.getIDToken = getIDToken; /** - * Markdown summary exports + * Summary exports */ -var markdown_summary_1 = __nccwpck_require__(8042); -Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return markdown_summary_1.markdownSummary; } })); +var summary_1 = __nccwpck_require__(1327); +Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); +/** + * @deprecated use core.summary + */ +var summary_2 = __nccwpck_require__(1327); +Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); //# sourceMappingURL=core.js.map /***/ }), @@ -473,7 +478,91 @@ exports.issueCommand = issueCommand; /***/ }), -/***/ 8042: +/***/ 8041: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OidcClient = void 0; +const http_client_1 = __nccwpck_require__(9925); +const auth_1 = __nccwpck_require__(3702); +const core_1 = __nccwpck_require__(2186); +class OidcClient { + static createHttpClient(allowRetry = true, maxRetry = 10) { + const requestOptions = { + allowRetries: allowRetry, + maxRetries: maxRetry + }; + return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); + } + static getRequestToken() { + const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; + if (!token) { + throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); + } + return token; + } + static getIDTokenUrl() { + const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; + if (!runtimeUrl) { + throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); + } + return runtimeUrl; + } + static getCall(id_token_url) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + const httpclient = OidcClient.createHttpClient(); + const res = yield httpclient + .getJson(id_token_url) + .catch(error => { + throw new Error(`Failed to get ID Token. \n + Error Code : ${error.statusCode}\n + Error Message: ${error.result.message}`); + }); + const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; + if (!id_token) { + throw new Error('Response json body do not have ID Token field'); + } + return id_token; + }); + } + static getIDToken(audience) { + return __awaiter(this, void 0, void 0, function* () { + try { + // New ID Token is requested from action service + let id_token_url = OidcClient.getIDTokenUrl(); + if (audience) { + const encodedAudience = encodeURIComponent(audience); + id_token_url = `${id_token_url}&audience=${encodedAudience}`; + } + core_1.debug(`ID token url is ${id_token_url}`); + const id_token = yield OidcClient.getCall(id_token_url); + core_1.setSecret(id_token); + return id_token; + } + catch (error) { + throw new Error(`Error message: ${error.message}`); + } + }); + } +} +exports.OidcClient = OidcClient; +//# sourceMappingURL=oidc-utils.js.map + +/***/ }), + +/***/ 1327: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -488,13 +577,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; +exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; const os_1 = __nccwpck_require__(2037); const fs_1 = __nccwpck_require__(7147); const { access, appendFile, writeFile } = fs_1.promises; exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; -exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary'; -class MarkdownSummary { +exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; +class Summary { constructor() { this._buffer = ''; } @@ -511,7 +600,7 @@ class MarkdownSummary { } const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; if (!pathFromEnv) { - throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports markdown summaries.`); + throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); } try { yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); @@ -546,7 +635,7 @@ class MarkdownSummary { * * @param {SummaryWriteOptions} [options] (optional) options for write operation * - * @returns {Promise} markdown summary instance + * @returns {Promise} summary instance */ write(options) { return __awaiter(this, void 0, void 0, function* () { @@ -560,7 +649,7 @@ class MarkdownSummary { /** * Clears the summary buffer and wipes the summary file * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ clear() { return __awaiter(this, void 0, void 0, function* () { @@ -586,7 +675,7 @@ class MarkdownSummary { /** * Resets the summary buffer without writing to summary file * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ emptyBuffer() { this._buffer = ''; @@ -598,7 +687,7 @@ class MarkdownSummary { * @param {string} text content to add * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addRaw(text, addEOL = false) { this._buffer += text; @@ -607,7 +696,7 @@ class MarkdownSummary { /** * Adds the operating system-specific end-of-line marker to the buffer * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addEOL() { return this.addRaw(os_1.EOL); @@ -618,7 +707,7 @@ class MarkdownSummary { * @param {string} code content to render within fenced code block * @param {string} lang (optional) language to syntax highlight code * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addCodeBlock(code, lang) { const attrs = Object.assign({}, (lang && { lang })); @@ -631,7 +720,7 @@ class MarkdownSummary { * @param {string[]} items list of items to render * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addList(items, ordered = false) { const tag = ordered ? 'ol' : 'ul'; @@ -644,7 +733,7 @@ class MarkdownSummary { * * @param {SummaryTableCell[]} rows table rows * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addTable(rows) { const tableBody = rows @@ -672,7 +761,7 @@ class MarkdownSummary { * @param {string} label text for the closed state * @param {string} content collapsable content * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addDetails(label, content) { const element = this.wrap('details', this.wrap('summary', label) + content); @@ -685,7 +774,7 @@ class MarkdownSummary { * @param {string} alt text description of the image * @param {SummaryImageOptions} options (optional) addition image attributes * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addImage(src, alt, options) { const { width, height } = options || {}; @@ -699,7 +788,7 @@ class MarkdownSummary { * @param {string} text heading text * @param {number | string} [level=1] (optional) the heading level, default: 1 * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addHeading(text, level) { const tag = `h${level}`; @@ -712,7 +801,7 @@ class MarkdownSummary { /** * Adds an HTML thematic break (
) to the summary buffer * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addSeparator() { const element = this.wrap('hr', null); @@ -721,7 +810,7 @@ class MarkdownSummary { /** * Adds an HTML line break (
) to the summary buffer * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addBreak() { const element = this.wrap('br', null); @@ -733,7 +822,7 @@ class MarkdownSummary { * @param {string} text quote text * @param {string} cite (optional) citation url * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addQuote(text, cite) { const attrs = Object.assign({}, (cite && { cite })); @@ -746,100 +835,20 @@ class MarkdownSummary { * @param {string} text link text/content * @param {string} href hyperlink * - * @returns {MarkdownSummary} markdown summary instance + * @returns {Summary} summary instance */ addLink(text, href) { const element = this.wrap('a', text, { href }); return this.addRaw(element).addEOL(); } } -// singleton export -exports.markdownSummary = new MarkdownSummary(); -//# sourceMappingURL=markdown-summary.js.map - -/***/ }), - -/***/ 8041: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(9925); -const auth_1 = __nccwpck_require__(3702); -const core_1 = __nccwpck_require__(2186); -class OidcClient { - static createHttpClient(allowRetry = true, maxRetry = 10) { - const requestOptions = { - allowRetries: allowRetry, - maxRetries: maxRetry - }; - return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); - } - static getRequestToken() { - const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; - if (!token) { - throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); - } - return token; - } - static getIDTokenUrl() { - const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; - if (!runtimeUrl) { - throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); - } - return runtimeUrl; - } - static getCall(id_token_url) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - const httpclient = OidcClient.createHttpClient(); - const res = yield httpclient - .getJson(id_token_url) - .catch(error => { - throw new Error(`Failed to get ID Token. \n - Error Code : ${error.statusCode}\n - Error Message: ${error.result.message}`); - }); - const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; - if (!id_token) { - throw new Error('Response json body do not have ID Token field'); - } - return id_token; - }); - } - static getIDToken(audience) { - return __awaiter(this, void 0, void 0, function* () { - try { - // New ID Token is requested from action service - let id_token_url = OidcClient.getIDTokenUrl(); - if (audience) { - const encodedAudience = encodeURIComponent(audience); - id_token_url = `${id_token_url}&audience=${encodedAudience}`; - } - core_1.debug(`ID token url is ${id_token_url}`); - const id_token = yield OidcClient.getCall(id_token_url); - core_1.setSecret(id_token); - return id_token; - } - catch (error) { - throw new Error(`Error message: ${error.message}`); - } - }); - } -} -exports.OidcClient = OidcClient; -//# sourceMappingURL=oidc-utils.js.map +const _summary = new Summary(); +/** + * @deprecated use `core.summary` + */ +exports.markdownSummary = _summary; +exports.summary = _summary; +//# sourceMappingURL=summary.js.map /***/ }), diff --git a/package-lock.json b/package-lock.json index b985cf8f..fd6d1b1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "repo-file-sync-action", - "version": "1.17.14", + "version": "1.17.15", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 607b6da9..89379089 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "repo-file-sync-action", - "version": "1.17.14", + "version": "1.17.15", "description": "GitHub Action to keep files like Action workflows or entire directories in sync between multiple repositories.", "main": "dist/index.js", "scripts": {