diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 0318f70..b53b65d 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -37,28 +37,6 @@ jobs:
skip_after_successful_duplicate: 'true'
paths_ignore: '["**/README.md", "**/docs/**"]'
- - name: Print outputs
- run: |
- echo '::group::should_skip'
- echo '${{ steps.skip_check.outputs.should_skip }}'
- echo '::endgroup::'
-
- echo '::group::reason'
- echo '${{ steps.skip_check.outputs.reason }}'
- echo '::endgroup::'
-
- echo '::group::skipped_by'
- echo '${{ toJSON(fromJSON(steps.skip_check.outputs.skipped_by)) }}'
- echo '::endgroup::'
-
- echo '::group::paths_result'
- echo '${{ toJSON(fromJSON(steps.skip_check.outputs.paths_result)) }}'
- echo '::endgroup::'
-
- echo '::group::changed_files'
- echo '${{ toJSON(fromJSON(steps.skip_check.outputs.changed_files)) }}'
- echo '::endgroup::'
-
main_job:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
diff --git a/dist/index.js b/dist/index.js
index 08cc47a..4a3c215 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -77,7 +77,7 @@ class SkipDuplicateActions {
// Abort early if current run has been triggered by an event that should never be skipped.
if (this.inputs.doNotSkip.includes(this.context.currentRun.event)) {
core.info(`Do not skip execution because the workflow was triggered with '${this.context.currentRun.event}'`);
- exitSuccess({
+ yield exitSuccess({
shouldSkip: false,
reason: 'do_not_skip'
});
@@ -87,7 +87,7 @@ class SkipDuplicateActions {
const successfulDuplicateRun = this.findSuccessfulDuplicateRun(this.context.currentRun.treeHash);
if (successfulDuplicateRun) {
core.info(`Skip execution because the exact same files have been successfully checked in run ${successfulDuplicateRun.htmlUrl}`);
- exitSuccess({
+ yield exitSuccess({
shouldSkip: true,
reason: 'skip_after_successful_duplicate',
skippedBy: successfulDuplicateRun
@@ -98,7 +98,7 @@ class SkipDuplicateActions {
if (this.inputs.concurrentSkipping !== 'never') {
const concurrentRun = this.detectConcurrentRuns();
if (concurrentRun) {
- exitSuccess({
+ yield exitSuccess({
shouldSkip: true,
reason: 'concurrent_skipping',
skippedBy: concurrentRun
@@ -110,19 +110,19 @@ class SkipDuplicateActions {
this.inputs.pathsIgnore.length >= 1 ||
Object.keys(this.inputs.pathsFilter).length >= 1) {
const { changedFiles, pathsResult } = yield this.backtracePathSkipping();
- exitSuccess({
+ yield exitSuccess({
shouldSkip: pathsResult.global.should_skip === 'unknown'
? false
: pathsResult.global.should_skip,
reason: 'paths',
skippedBy: pathsResult.global.skipped_by,
- changedFiles,
- pathsResult
+ pathsResult,
+ changedFiles
});
}
// Do not skip otherwise.
core.info('Do not skip execution because we did not find a transferable run');
- exitSuccess({
+ yield exitSuccess({
shouldSkip: false,
reason: 'no_transferable_run'
});
@@ -226,7 +226,11 @@ class SkipDuplicateActions {
.map(file => file.filename)
.filter(file => typeof file === 'string')
: [];
- allChangedFiles.push(changedFiles);
+ allChangedFiles.push({
+ sha: commit.sha,
+ htmlUrl: commit.html_url,
+ changedFiles
+ });
const successfulRun = (distanceToHEAD >= 1 &&
this.findSuccessfulDuplicateRun(commit.commit.tree.sha)) ||
undefined;
@@ -277,7 +281,7 @@ class SkipDuplicateActions {
break;
}
} while (Object.keys(pathsResult).some(path => pathsResult[path].should_skip === 'unknown'));
- return { changedFiles: allChangedFiles, pathsResult };
+ return { pathsResult, changedFiles: allChangedFiles };
});
}
isCommitPathsIgnored(changedFiles, pathsIgnore) {
@@ -387,12 +391,44 @@ function mapWorkflowRun(run, treeHash) {
}
/** Set all outputs and exit the action. */
function exitSuccess(args) {
- core.setOutput('should_skip', args.shouldSkip);
- core.setOutput('reason', args.reason);
- core.setOutput('skipped_by', args.skippedBy || {});
- core.setOutput('changed_files', args.changedFiles || []);
- core.setOutput('paths_result', args.pathsResult || {});
- process.exit(0);
+ var _a;
+ return __awaiter(this, void 0, void 0, function* () {
+ const summary = [
+ '
',
+ '',
+ '',
+ 'Should Skip | ',
+ `${args.shouldSkip ? 'Yes' : 'No'} (${args.shouldSkip}) | `,
+ '
',
+ '',
+ 'Reason | ',
+ `${args.reason} | `,
+ '
'
+ ];
+ if (args.skippedBy) {
+ summary.push('', 'Skipped By | ', `${args.skippedBy.runNumber} | `, '
');
+ }
+ if (args.pathsResult) {
+ summary.push('', 'Paths Result | ', `${JSON.stringify(args.pathsResult, null, 2)} | `, '
');
+ }
+ if (args.changedFiles) {
+ const changedFiles = args.changedFiles
+ .map(commit => `${commit.sha.substring(0, 7)}:
+ ${commit.changedFiles
+ .map(file => `- ${file}
`)
+ .join('')}
`)
+ .join('');
+ summary.push('', 'Changed Files | ', `${changedFiles} | `, '
');
+ }
+ summary.push('
');
+ yield core.summary.addRaw(summary.join('')).write();
+ core.setOutput('should_skip', args.shouldSkip);
+ core.setOutput('reason', args.reason);
+ core.setOutput('skipped_by', args.skippedBy || {});
+ core.setOutput('paths_result', args.pathsResult || {});
+ core.setOutput('changed_files', ((_a = args.changedFiles) === null || _a === void 0 ? void 0 : _a.map(commit => commit.changedFiles)) || []);
+ process.exit(0);
+ });
}
/** Immediately terminate the action with failing exit code. */
function exitFail(error) {
@@ -1572,8 +1608,9 @@ exports.context = new Context.Context();
* @param token the repo PAT or GITHUB_TOKEN
* @param options other options to set
*/
-function getOctokit(token, options) {
- return new utils_1.GitHub(utils_1.getOctokitOptions(token, options));
+function getOctokit(token, options, ...additionalPlugins) {
+ const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
+ return new GitHubWithPlugins(utils_1.getOctokitOptions(token, options));
}
exports.getOctokit = getOctokit;
//# sourceMappingURL=github.js.map
@@ -2533,7 +2570,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
var universalUserAgent = __nccwpck_require__(5030);
var beforeAfterHook = __nccwpck_require__(3682);
var request = __nccwpck_require__(6234);
-var graphql = __nccwpck_require__(6442);
+var graphql = __nccwpck_require__(8467);
var authToken = __nccwpck_require__(334);
function _objectWithoutPropertiesLoose(source, excluded) {
@@ -2704,132 +2741,6 @@ exports.Octokit = Octokit;
//# sourceMappingURL=index.js.map
-/***/ }),
-
-/***/ 6442:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-
-var request = __nccwpck_require__(6234);
-var universalUserAgent = __nccwpck_require__(5030);
-
-const VERSION = "4.8.0";
-
-function _buildMessageForResponseErrors(data) {
- return `Request failed due to following response errors:\n` + data.errors.map(e => ` - ${e.message}`).join("\n");
-}
-
-class GraphqlResponseError extends Error {
- constructor(request, headers, response) {
- super(_buildMessageForResponseErrors(response));
- this.request = request;
- this.headers = headers;
- this.response = response;
- this.name = "GraphqlResponseError"; // Expose the errors and response data in their shorthand properties.
-
- this.errors = response.errors;
- this.data = response.data; // Maintains proper stack trace (only available on V8)
-
- /* istanbul ignore next */
-
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, this.constructor);
- }
- }
-
-}
-
-const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"];
-const FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
-const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
-function graphql(request, query, options) {
- if (options) {
- if (typeof query === "string" && "query" in options) {
- return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`));
- }
-
- for (const key in options) {
- if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue;
- return Promise.reject(new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`));
- }
- }
-
- const parsedOptions = typeof query === "string" ? Object.assign({
- query
- }, options) : query;
- const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {
- if (NON_VARIABLE_OPTIONS.includes(key)) {
- result[key] = parsedOptions[key];
- return result;
- }
-
- if (!result.variables) {
- result.variables = {};
- }
-
- result.variables[key] = parsedOptions[key];
- return result;
- }, {}); // workaround for GitHub Enterprise baseUrl set with /api/v3 suffix
- // https://github.com/octokit/auth-app.js/issues/111#issuecomment-657610451
-
- const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;
-
- if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
- requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
- }
-
- return request(requestOptions).then(response => {
- if (response.data.errors) {
- const headers = {};
-
- for (const key of Object.keys(response.headers)) {
- headers[key] = response.headers[key];
- }
-
- throw new GraphqlResponseError(requestOptions, headers, response.data);
- }
-
- return response.data.data;
- });
-}
-
-function withDefaults(request$1, newDefaults) {
- const newRequest = request$1.defaults(newDefaults);
-
- const newApi = (query, options) => {
- return graphql(newRequest, query, options);
- };
-
- return Object.assign(newApi, {
- defaults: withDefaults.bind(null, newRequest),
- endpoint: request.request.endpoint
- });
-}
-
-const graphql$1 = withDefaults(request.request, {
- headers: {
- "user-agent": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}`
- },
- method: "POST",
- url: "/graphql"
-});
-function withCustomRequest(customRequest) {
- return withDefaults(customRequest, {
- method: "POST",
- url: "/graphql"
- });
-}
-
-exports.GraphqlResponseError = GraphqlResponseError;
-exports.graphql = graphql$1;
-exports.withCustomRequest = withCustomRequest;
-//# sourceMappingURL=index.js.map
-
-
/***/ }),
/***/ 9440:
@@ -3228,6 +3139,132 @@ exports.endpoint = endpoint;
//# sourceMappingURL=index.js.map
+/***/ }),
+
+/***/ 8467:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+
+var request = __nccwpck_require__(6234);
+var universalUserAgent = __nccwpck_require__(5030);
+
+const VERSION = "4.8.0";
+
+function _buildMessageForResponseErrors(data) {
+ return `Request failed due to following response errors:\n` + data.errors.map(e => ` - ${e.message}`).join("\n");
+}
+
+class GraphqlResponseError extends Error {
+ constructor(request, headers, response) {
+ super(_buildMessageForResponseErrors(response));
+ this.request = request;
+ this.headers = headers;
+ this.response = response;
+ this.name = "GraphqlResponseError"; // Expose the errors and response data in their shorthand properties.
+
+ this.errors = response.errors;
+ this.data = response.data; // Maintains proper stack trace (only available on V8)
+
+ /* istanbul ignore next */
+
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+ }
+
+}
+
+const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"];
+const FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
+const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
+function graphql(request, query, options) {
+ if (options) {
+ if (typeof query === "string" && "query" in options) {
+ return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`));
+ }
+
+ for (const key in options) {
+ if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue;
+ return Promise.reject(new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`));
+ }
+ }
+
+ const parsedOptions = typeof query === "string" ? Object.assign({
+ query
+ }, options) : query;
+ const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {
+ if (NON_VARIABLE_OPTIONS.includes(key)) {
+ result[key] = parsedOptions[key];
+ return result;
+ }
+
+ if (!result.variables) {
+ result.variables = {};
+ }
+
+ result.variables[key] = parsedOptions[key];
+ return result;
+ }, {}); // workaround for GitHub Enterprise baseUrl set with /api/v3 suffix
+ // https://github.com/octokit/auth-app.js/issues/111#issuecomment-657610451
+
+ const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;
+
+ if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
+ requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
+ }
+
+ return request(requestOptions).then(response => {
+ if (response.data.errors) {
+ const headers = {};
+
+ for (const key of Object.keys(response.headers)) {
+ headers[key] = response.headers[key];
+ }
+
+ throw new GraphqlResponseError(requestOptions, headers, response.data);
+ }
+
+ return response.data.data;
+ });
+}
+
+function withDefaults(request$1, newDefaults) {
+ const newRequest = request$1.defaults(newDefaults);
+
+ const newApi = (query, options) => {
+ return graphql(newRequest, query, options);
+ };
+
+ return Object.assign(newApi, {
+ defaults: withDefaults.bind(null, newRequest),
+ endpoint: request.request.endpoint
+ });
+}
+
+const graphql$1 = withDefaults(request.request, {
+ headers: {
+ "user-agent": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}`
+ },
+ method: "POST",
+ url: "/graphql"
+});
+function withCustomRequest(customRequest) {
+ return withDefaults(customRequest, {
+ method: "POST",
+ url: "/graphql"
+ });
+}
+
+exports.GraphqlResponseError = GraphqlResponseError;
+exports.graphql = graphql$1;
+exports.withCustomRequest = withCustomRequest;
+//# sourceMappingURL=index.js.map
+
+
/***/ }),
/***/ 4193:
diff --git a/package-lock.json b/package-lock.json
index c05d16c..b48e683 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -35,9 +35,9 @@
}
},
"node_modules/@actions/github": {
- "version": "5.0.3",
- "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.3.tgz",
- "integrity": "sha512-myjA/pdLQfhUGLtRZC/J4L1RXOG4o6aYdiEq+zr5wVVKljzbFld+xv10k1FX6IkIJtNxbAq44BdwSNpQ015P0A==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.1.0.tgz",
+ "integrity": "sha512-tuI80F7JQIhg77ZTTgUAPpVD7ZnP9oHSPN8xw7LOwtA4vEMbAjWJNbmLBfV7xua7r016GyjzWLuec5cs8f/a8A==",
"dependencies": {
"@actions/http-client": "^2.0.1",
"@octokit/core": "^3.6.0",
@@ -102,9 +102,9 @@
}
},
"node_modules/@humanwhocodes/config-array": {
- "version": "0.10.4",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz",
- "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==",
+ "version": "0.10.5",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.5.tgz",
+ "integrity": "sha512-XVVDtp+dVvRxMoxSiSfasYaG02VEe1qH5cKgMQJWhol6HwzbcqoCMJi8dAGoYAO57jhUyhI6cWuRiTcRaDaYug==",
"dev": true,
"dependencies": {
"@humanwhocodes/object-schema": "^1.2.1",
@@ -201,16 +201,6 @@
"universal-user-agent": "^6.0.0"
}
},
- "node_modules/@octokit/core/node_modules/@octokit/graphql": {
- "version": "4.8.0",
- "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz",
- "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==",
- "dependencies": {
- "@octokit/request": "^5.6.0",
- "@octokit/types": "^6.0.3",
- "universal-user-agent": "^6.0.0"
- }
- },
"node_modules/@octokit/endpoint": {
"version": "6.0.12",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz",
@@ -221,6 +211,16 @@
"universal-user-agent": "^6.0.0"
}
},
+ "node_modules/@octokit/graphql": {
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz",
+ "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==",
+ "dependencies": {
+ "@octokit/request": "^5.6.0",
+ "@octokit/types": "^6.0.3",
+ "universal-user-agent": "^6.0.0"
+ }
+ },
"node_modules/@octokit/openapi-types": {
"version": "12.11.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz",
@@ -314,9 +314,9 @@
}
},
"node_modules/@types/node": {
- "version": "16.11.59",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.59.tgz",
- "integrity": "sha512-6u+36Dj3aDzhfBVUf/mfmc92OEdzQ2kx2jcXGdigfl70E/neV21ZHE6UCz4MDzTRcVqGAM27fk+DLXvyDsn3Jw==",
+ "version": "16.11.60",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.60.tgz",
+ "integrity": "sha512-kYIYa1D1L+HDv5M5RXQeEu1o0FKA6yedZIoyugm/MBPROkLpX4L7HRxMrPVyo8bnvjpW/wDlqFNGzXNMb7AdRw==",
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
@@ -741,9 +741,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001406",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001406.tgz",
- "integrity": "sha512-bWTlaXUy/rq0BBtYShc/jArYfBPjEV95euvZ8JVtO43oQExEN/WquoqpufFjNu4kSpi5cy5kMbNvzztWDfv1Jg==",
+ "version": "1.0.30001412",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001412.tgz",
+ "integrity": "sha512-+TeEIee1gS5bYOiuf+PS/kp2mrXic37Hl66VY6EAfxasIk5fELTktK2oOezYed12H8w7jt3s512PpulQidPjwA==",
"dev": true,
"funding": [
{
@@ -797,9 +797,9 @@
"dev": true
},
"node_modules/core-js-pure": {
- "version": "3.25.2",
- "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.25.2.tgz",
- "integrity": "sha512-ItD7YpW1cUB4jaqFLZXe1AXkyqIxz6GqPnsDV4uF4hVcWh/WAGIqSqw5p0/WdsILM0Xht9s3Koyw05R3K6RtiA==",
+ "version": "3.25.3",
+ "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.25.3.tgz",
+ "integrity": "sha512-T/7qvgv70MEvRkZ8p6BasLZmOVYKzOaWNBEHAU8FmveCJkl4nko2quqPQOmy6AJIp5MBanhz9no3A94NoRb0XA==",
"dev": true,
"hasInstallScript": true,
"funding": {
@@ -896,9 +896,9 @@
}
},
"node_modules/electron-to-chromium": {
- "version": "1.4.254",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.254.tgz",
- "integrity": "sha512-Sh/7YsHqQYkA6ZHuHMy24e6TE4eX6KZVsZb9E/DvU1nQRIrH4BflO/4k+83tfdYvDl+MObvlqHPRICzEdC9c6Q==",
+ "version": "1.4.262",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.262.tgz",
+ "integrity": "sha512-Ckn5haqmGh/xS8IbcgK3dnwAVnhDyo/WQnklWn6yaMucYTq7NNxwlGE8ElzEOnonzRLzUCo2Ot3vUb2GYUF2Hw==",
"dev": true
},
"node_modules/emoji-regex": {
@@ -908,22 +908,22 @@
"dev": true
},
"node_modules/es-abstract": {
- "version": "1.20.2",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.2.tgz",
- "integrity": "sha512-XxXQuVNrySBNlEkTYJoDNFe5+s2yIOpzq80sUHEdPdQr0S5nTLz4ZPPPswNIpKseDDUS5yghX1gfLIHQZ1iNuQ==",
+ "version": "1.20.3",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.3.tgz",
+ "integrity": "sha512-AyrnaKVpMzljIdwjzrj+LxGmj8ik2LckwXacHqrJJ/jxz6dDDBcZ7I7nlHM0FvEW8MfbWJwOd+yT2XzYW49Frw==",
"dev": true,
"dependencies": {
"call-bind": "^1.0.2",
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"function.prototype.name": "^1.1.5",
- "get-intrinsic": "^1.1.2",
+ "get-intrinsic": "^1.1.3",
"get-symbol-description": "^1.0.0",
"has": "^1.0.3",
"has-property-descriptors": "^1.0.0",
"has-symbols": "^1.0.3",
"internal-slot": "^1.0.3",
- "is-callable": "^1.2.4",
+ "is-callable": "^1.2.6",
"is-negative-zero": "^2.0.2",
"is-regex": "^1.1.4",
"is-shared-array-buffer": "^1.0.2",
@@ -933,6 +933,7 @@
"object-keys": "^1.1.1",
"object.assign": "^4.1.4",
"regexp.prototype.flags": "^1.4.3",
+ "safe-regex-test": "^1.0.0",
"string.prototype.trimend": "^1.0.5",
"string.prototype.trimstart": "^1.0.5",
"unbox-primitive": "^1.0.2"
@@ -992,13 +993,13 @@
}
},
"node_modules/eslint": {
- "version": "8.23.1",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.1.tgz",
- "integrity": "sha512-w7C1IXCc6fNqjpuYd0yPlcTKKmHlHHktRkzmBPZ+7cvNBQuiNjx0xaMTjAJGCafJhQkrFJooREv0CtrVzmHwqg==",
+ "version": "8.24.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz",
+ "integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==",
"dev": true,
"dependencies": {
"@eslint/eslintrc": "^1.3.2",
- "@humanwhocodes/config-array": "^0.10.4",
+ "@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
"@humanwhocodes/module-importer": "^1.0.1",
"ajv": "^6.10.0",
@@ -1897,9 +1898,9 @@
}
},
"node_modules/is-callable": {
- "version": "1.2.6",
- "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.6.tgz",
- "integrity": "sha512-krO72EO2NptOGAX2KYyqbP9vYMlNAXdB53rq6f8LXY6RY7JdSR/3BD6wLUlPHSAesmY9vstNrjvqGaCiRK/91Q==",
+ "version": "1.2.7",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
+ "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==",
"dev": true,
"engines": {
"node": ">= 0.4"
@@ -2643,6 +2644,20 @@
"queue-microtask": "^1.2.2"
}
},
+ "node_modules/safe-regex-test": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz",
+ "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "get-intrinsic": "^1.1.3",
+ "is-regex": "^1.1.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
@@ -3049,9 +3064,9 @@
}
},
"@actions/github": {
- "version": "5.0.3",
- "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.3.tgz",
- "integrity": "sha512-myjA/pdLQfhUGLtRZC/J4L1RXOG4o6aYdiEq+zr5wVVKljzbFld+xv10k1FX6IkIJtNxbAq44BdwSNpQ015P0A==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.1.0.tgz",
+ "integrity": "sha512-tuI80F7JQIhg77ZTTgUAPpVD7ZnP9oHSPN8xw7LOwtA4vEMbAjWJNbmLBfV7xua7r016GyjzWLuec5cs8f/a8A==",
"requires": {
"@actions/http-client": "^2.0.1",
"@octokit/core": "^3.6.0",
@@ -3104,9 +3119,9 @@
}
},
"@humanwhocodes/config-array": {
- "version": "0.10.4",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz",
- "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==",
+ "version": "0.10.5",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.5.tgz",
+ "integrity": "sha512-XVVDtp+dVvRxMoxSiSfasYaG02VEe1qH5cKgMQJWhol6HwzbcqoCMJi8dAGoYAO57jhUyhI6cWuRiTcRaDaYug==",
"dev": true,
"requires": {
"@humanwhocodes/object-schema": "^1.2.1",
@@ -3178,18 +3193,6 @@
"@octokit/types": "^6.0.3",
"before-after-hook": "^2.2.0",
"universal-user-agent": "^6.0.0"
- },
- "dependencies": {
- "@octokit/graphql": {
- "version": "4.8.0",
- "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz",
- "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==",
- "requires": {
- "@octokit/request": "^5.6.0",
- "@octokit/types": "^6.0.3",
- "universal-user-agent": "^6.0.0"
- }
- }
}
},
"@octokit/endpoint": {
@@ -3202,6 +3205,16 @@
"universal-user-agent": "^6.0.0"
}
},
+ "@octokit/graphql": {
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz",
+ "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==",
+ "requires": {
+ "@octokit/request": "^5.6.0",
+ "@octokit/types": "^6.0.3",
+ "universal-user-agent": "^6.0.0"
+ }
+ },
"@octokit/openapi-types": {
"version": "12.11.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz",
@@ -3289,9 +3302,9 @@
}
},
"@types/node": {
- "version": "16.11.59",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.59.tgz",
- "integrity": "sha512-6u+36Dj3aDzhfBVUf/mfmc92OEdzQ2kx2jcXGdigfl70E/neV21ZHE6UCz4MDzTRcVqGAM27fk+DLXvyDsn3Jw==",
+ "version": "16.11.60",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.60.tgz",
+ "integrity": "sha512-kYIYa1D1L+HDv5M5RXQeEu1o0FKA6yedZIoyugm/MBPROkLpX4L7HRxMrPVyo8bnvjpW/wDlqFNGzXNMb7AdRw==",
"dev": true
},
"@typescript-eslint/eslint-plugin": {
@@ -3557,9 +3570,9 @@
"dev": true
},
"caniuse-lite": {
- "version": "1.0.30001406",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001406.tgz",
- "integrity": "sha512-bWTlaXUy/rq0BBtYShc/jArYfBPjEV95euvZ8JVtO43oQExEN/WquoqpufFjNu4kSpi5cy5kMbNvzztWDfv1Jg==",
+ "version": "1.0.30001412",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001412.tgz",
+ "integrity": "sha512-+TeEIee1gS5bYOiuf+PS/kp2mrXic37Hl66VY6EAfxasIk5fELTktK2oOezYed12H8w7jt3s512PpulQidPjwA==",
"dev": true
},
"chalk": {
@@ -3594,9 +3607,9 @@
"dev": true
},
"core-js-pure": {
- "version": "3.25.2",
- "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.25.2.tgz",
- "integrity": "sha512-ItD7YpW1cUB4jaqFLZXe1AXkyqIxz6GqPnsDV4uF4hVcWh/WAGIqSqw5p0/WdsILM0Xht9s3Koyw05R3K6RtiA==",
+ "version": "3.25.3",
+ "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.25.3.tgz",
+ "integrity": "sha512-T/7qvgv70MEvRkZ8p6BasLZmOVYKzOaWNBEHAU8FmveCJkl4nko2quqPQOmy6AJIp5MBanhz9no3A94NoRb0XA==",
"dev": true
},
"cross-spawn": {
@@ -3665,9 +3678,9 @@
}
},
"electron-to-chromium": {
- "version": "1.4.254",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.254.tgz",
- "integrity": "sha512-Sh/7YsHqQYkA6ZHuHMy24e6TE4eX6KZVsZb9E/DvU1nQRIrH4BflO/4k+83tfdYvDl+MObvlqHPRICzEdC9c6Q==",
+ "version": "1.4.262",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.262.tgz",
+ "integrity": "sha512-Ckn5haqmGh/xS8IbcgK3dnwAVnhDyo/WQnklWn6yaMucYTq7NNxwlGE8ElzEOnonzRLzUCo2Ot3vUb2GYUF2Hw==",
"dev": true
},
"emoji-regex": {
@@ -3677,22 +3690,22 @@
"dev": true
},
"es-abstract": {
- "version": "1.20.2",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.2.tgz",
- "integrity": "sha512-XxXQuVNrySBNlEkTYJoDNFe5+s2yIOpzq80sUHEdPdQr0S5nTLz4ZPPPswNIpKseDDUS5yghX1gfLIHQZ1iNuQ==",
+ "version": "1.20.3",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.3.tgz",
+ "integrity": "sha512-AyrnaKVpMzljIdwjzrj+LxGmj8ik2LckwXacHqrJJ/jxz6dDDBcZ7I7nlHM0FvEW8MfbWJwOd+yT2XzYW49Frw==",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"function.prototype.name": "^1.1.5",
- "get-intrinsic": "^1.1.2",
+ "get-intrinsic": "^1.1.3",
"get-symbol-description": "^1.0.0",
"has": "^1.0.3",
"has-property-descriptors": "^1.0.0",
"has-symbols": "^1.0.3",
"internal-slot": "^1.0.3",
- "is-callable": "^1.2.4",
+ "is-callable": "^1.2.6",
"is-negative-zero": "^2.0.2",
"is-regex": "^1.1.4",
"is-shared-array-buffer": "^1.0.2",
@@ -3702,6 +3715,7 @@
"object-keys": "^1.1.1",
"object.assign": "^4.1.4",
"regexp.prototype.flags": "^1.4.3",
+ "safe-regex-test": "^1.0.0",
"string.prototype.trimend": "^1.0.5",
"string.prototype.trimstart": "^1.0.5",
"unbox-primitive": "^1.0.2"
@@ -3740,13 +3754,13 @@
"dev": true
},
"eslint": {
- "version": "8.23.1",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.1.tgz",
- "integrity": "sha512-w7C1IXCc6fNqjpuYd0yPlcTKKmHlHHktRkzmBPZ+7cvNBQuiNjx0xaMTjAJGCafJhQkrFJooREv0CtrVzmHwqg==",
+ "version": "8.24.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz",
+ "integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==",
"dev": true,
"requires": {
"@eslint/eslintrc": "^1.3.2",
- "@humanwhocodes/config-array": "^0.10.4",
+ "@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
"@humanwhocodes/module-importer": "^1.0.1",
"ajv": "^6.10.0",
@@ -4425,9 +4439,9 @@
}
},
"is-callable": {
- "version": "1.2.6",
- "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.6.tgz",
- "integrity": "sha512-krO72EO2NptOGAX2KYyqbP9vYMlNAXdB53rq6f8LXY6RY7JdSR/3BD6wLUlPHSAesmY9vstNrjvqGaCiRK/91Q==",
+ "version": "1.2.7",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
+ "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==",
"dev": true
},
"is-core-module": {
@@ -4936,6 +4950,17 @@
"queue-microtask": "^1.2.2"
}
},
+ "safe-regex-test": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz",
+ "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.2",
+ "get-intrinsic": "^1.1.3",
+ "is-regex": "^1.1.4"
+ }
+ },
"semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
diff --git a/src/main.ts b/src/main.ts
index e6602c5..0777fa8 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -46,6 +46,8 @@ interface WorkflowRun {
createdAt: string
}
+type ChangedFiles = {sha: string; htmlUrl: string; changedFiles: string[]}[]
+
type PathsFilter = Record<
string,
{
@@ -115,7 +117,7 @@ class SkipDuplicateActions {
core.info(
`Do not skip execution because the workflow was triggered with '${this.context.currentRun.event}'`
)
- exitSuccess({
+ await exitSuccess({
shouldSkip: false,
reason: 'do_not_skip'
})
@@ -130,7 +132,7 @@ class SkipDuplicateActions {
core.info(
`Skip execution because the exact same files have been successfully checked in run ${successfulDuplicateRun.htmlUrl}`
)
- exitSuccess({
+ await exitSuccess({
shouldSkip: true,
reason: 'skip_after_successful_duplicate',
skippedBy: successfulDuplicateRun
@@ -142,7 +144,7 @@ class SkipDuplicateActions {
if (this.inputs.concurrentSkipping !== 'never') {
const concurrentRun = this.detectConcurrentRuns()
if (concurrentRun) {
- exitSuccess({
+ await exitSuccess({
shouldSkip: true,
reason: 'concurrent_skipping',
skippedBy: concurrentRun
@@ -157,15 +159,15 @@ class SkipDuplicateActions {
Object.keys(this.inputs.pathsFilter).length >= 1
) {
const {changedFiles, pathsResult} = await this.backtracePathSkipping()
- exitSuccess({
+ await exitSuccess({
shouldSkip:
pathsResult.global.should_skip === 'unknown'
? false
: pathsResult.global.should_skip,
reason: 'paths',
skippedBy: pathsResult.global.skipped_by,
- changedFiles,
- pathsResult
+ pathsResult,
+ changedFiles
})
}
@@ -173,7 +175,7 @@ class SkipDuplicateActions {
core.info(
'Do not skip execution because we did not find a transferable run'
)
- exitSuccess({
+ await exitSuccess({
shouldSkip: false,
reason: 'no_transferable_run'
})
@@ -277,13 +279,13 @@ class SkipDuplicateActions {
}
async backtracePathSkipping(): Promise<{
- changedFiles: string[][]
pathsResult: PathsResult
+ changedFiles: ChangedFiles
}> {
let commit: ApiCommit | null
let iterSha: string | null = this.context.currentRun.commitHash
let distanceToHEAD = 0
- const allChangedFiles: string[][] = []
+ const allChangedFiles: ChangedFiles = []
const pathsFilter: PathsFilter = {
...this.inputs.pathsFilter,
@@ -310,7 +312,11 @@ class SkipDuplicateActions {
.map(file => file.filename)
.filter(file => typeof file === 'string')
: []
- allChangedFiles.push(changedFiles)
+ allChangedFiles.push({
+ sha: commit.sha,
+ htmlUrl: commit.html_url,
+ changedFiles
+ })
const successfulRun =
(distanceToHEAD >= 1 &&
@@ -395,7 +401,7 @@ class SkipDuplicateActions {
)
)
- return {changedFiles: allChangedFiles, pathsResult}
+ return {pathsResult, changedFiles: allChangedFiles}
}
isCommitPathsIgnored(changedFiles: string[], pathsIgnore: string[]): boolean {
@@ -533,18 +539,73 @@ function mapWorkflowRun(
}
/** Set all outputs and exit the action. */
-function exitSuccess(args: {
+async function exitSuccess(args: {
shouldSkip: boolean
reason: string
skippedBy?: WorkflowRun
- changedFiles?: string[][]
pathsResult?: PathsResult
-}): never {
+ changedFiles?: ChangedFiles
+}): Promise {
+ const summary = [
+ '',
+ '',
+ '',
+ 'Should Skip | ',
+ `${args.shouldSkip ? 'Yes' : 'No'} (${args.shouldSkip}) | `,
+ '
',
+ '',
+ 'Reason | ',
+ `${args.reason} | `,
+ '
'
+ ]
+ if (args.skippedBy) {
+ summary.push(
+ '',
+ 'Skipped By | ',
+ `${args.skippedBy.runNumber} | `,
+ '
'
+ )
+ }
+ if (args.pathsResult) {
+ summary.push(
+ '',
+ 'Paths Result | ',
+ `${JSON.stringify(
+ args.pathsResult,
+ null,
+ 2
+ )} | `,
+ '
'
+ )
+ }
+ if (args.changedFiles) {
+ const changedFiles = args.changedFiles
+ .map(
+ commit =>
+ `${commit.sha.substring(0, 7)}:
+ ${commit.changedFiles
+ .map(file => `- ${file}
`)
+ .join('')}
`
+ )
+ .join('')
+ summary.push(
+ '',
+ 'Changed Files | ',
+ `${changedFiles} | `,
+ '
'
+ )
+ }
+ summary.push('
')
+ await core.summary.addRaw(summary.join('')).write()
+
core.setOutput('should_skip', args.shouldSkip)
core.setOutput('reason', args.reason)
core.setOutput('skipped_by', args.skippedBy || {})
- core.setOutput('changed_files', args.changedFiles || [])
core.setOutput('paths_result', args.pathsResult || {})
+ core.setOutput(
+ 'changed_files',
+ args.changedFiles?.map(commit => commit.changedFiles) || []
+ )
process.exit(0)
}