Skip to content
This repository was archived by the owner on May 15, 2021. It is now read-only.

Commit 0fc3f15

Browse files
committedNov 22, 2020
feat: build for release
1 parent 0b2a109 commit 0fc3f15

File tree

11 files changed

+109
-92
lines changed

11 files changed

+109
-92
lines changed
 

‎build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"owner":"technote-space","repo":"auto-cancel-redundant-workflow","sha":"81971456813bf2fdc0eb4c93b9e7fe34d568048b","ref":"refs/tags/test/v1.6.4.364210129","tagName":"test/v1.6.4.364210129","branch":"gh-actions","tags":["test/v1.6.4.364210129","test/v1.6.4","test/v1.6","test/v1"],"updated_at":"2020-11-15T09:07:41.860Z"}
1+
{"owner":"technote-space","repo":"auto-cancel-redundant-workflow","sha":"d233f4c34d25fbe7b01190ca4522e3e4d82446a5","ref":"refs/tags/test/v1.6.4.377118758","tagName":"test/v1.6.4.377118758","branch":"gh-actions","tags":["test/v1.6.4.377118758","test/v1.6.4","test/v1.6","test/v1"],"updated_at":"2020-11-22T09:08:11.697Z"}

‎lib/process.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exports.execute = void 0;
1313
const core_1 = require("@actions/core");
1414
const misc_1 = require("./utils/misc");
1515
const workflow_1 = require("./utils/workflow");
16-
exports.execute = (logger, octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
16+
const execute = (logger, octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
1717
if (misc_1.isExcludeContext(context)) {
1818
logger.info('This is not target context.');
1919
core_1.setOutput('ids', '');
@@ -49,3 +49,4 @@ exports.execute = (logger, octokit, context) => __awaiter(void 0, void 0, void 0
4949
core_1.setOutput('ids', runsWithCreatedAtTime.map(run => run.id).join(','));
5050
logger.endProcess();
5151
});
52+
exports.execute = execute;

‎lib/utils/misc.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@ const constant_1 = require("../constant");
1616
const getMergeMessagePrefix = () => github_action_helper_1.Utils.getPrefixRegExp(core_1.getInput('MERGE_MESSAGE_PREFIX'));
1717
const isExcludeMerged = () => github_action_helper_1.Utils.getBoolValue(core_1.getInput('EXCLUDE_MERGED'));
1818
const isExcludeTagPush = () => github_action_helper_1.Utils.getBoolValue(core_1.getInput('EXCLUDE_TAG_PUSH'));
19-
exports.isExcludeContext = (context) => github_action_helper_1.ContextHelper.isPush(context) && ((isExcludeTagPush() && github_action_helper_1.Utils.isTagRef(context)) ||
19+
const isExcludeContext = (context) => github_action_helper_1.ContextHelper.isPush(context) && ((isExcludeTagPush() && github_action_helper_1.Utils.isTagRef(context)) ||
2020
(isExcludeMerged() && getMergeMessagePrefix().test(context.payload.head_commit.message)));
21-
exports.isNotExcludeRun = (run) => !isExcludeMerged() || !getMergeMessagePrefix().test(run.head_commit.message);
22-
exports.getRunId = () => Number(process.env.GITHUB_RUN_ID);
23-
exports.getTargetBranch = (octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
21+
exports.isExcludeContext = isExcludeContext;
22+
const isNotExcludeRun = (run) => !isExcludeMerged() || !getMergeMessagePrefix().test(run.head_commit.message);
23+
exports.isNotExcludeRun = isNotExcludeRun;
24+
const getRunId = () => Number(process.env.GITHUB_RUN_ID);
25+
exports.getRunId = getRunId;
26+
const getTargetBranch = (octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
2427
if (context.payload.pull_request) {
2528
return context.payload.pull_request.head.ref;
2629
}
2730
return github_action_helper_1.Utils.getBranch(context) || undefined;
2831
});
32+
exports.getTargetBranch = getTargetBranch;
2933
// eslint-disable-next-line @typescript-eslint/no-explicit-any
30-
exports.getFilteredRun = (run) => Object.assign({}, ...constant_1.SHOW_PROPERTIES.map(key => ({ [key]: run[key] })));
34+
const getFilteredRun = (run) => Object.assign({}, ...constant_1.SHOW_PROPERTIES.map(key => ({ [key]: run[key] })));
35+
exports.getFilteredRun = getFilteredRun;

‎lib/utils/workflow.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
1111
Object.defineProperty(exports, "__esModule", { value: true });
1212
exports.cancelWorkflowRun = exports.getWorkflowRuns = exports.getWorkflowRunNumber = exports.getWorkflowRunCreatedAt = exports.getWorkflowId = exports.getWorkflowRun = void 0;
1313
const misc_1 = require("./misc");
14-
exports.getWorkflowRun = (octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
14+
const getWorkflowRun = (octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
1515
return (yield octokit.actions.getWorkflowRun({
1616
owner: context.repo.owner,
1717
repo: context.repo.repo,
1818
'run_id': Number(process.env.GITHUB_RUN_ID),
1919
})).data;
2020
});
21-
exports.getWorkflowId = (run) => {
21+
exports.getWorkflowRun = getWorkflowRun;
22+
const getWorkflowId = (run) => {
2223
const matches = run.workflow_url.match(/\d+$/);
2324
if (!matches) {
2425
throw new Error('Invalid workflow run');
2526
}
2627
return Number(matches[0]);
2728
};
28-
exports.getWorkflowRunCreatedAt = (run) => run.created_at;
29-
exports.getWorkflowRunNumber = (run) => run.run_number;
30-
exports.getWorkflowRuns = (workflowId, logger, octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
29+
exports.getWorkflowId = getWorkflowId;
30+
const getWorkflowRunCreatedAt = (run) => run.created_at;
31+
exports.getWorkflowRunCreatedAt = getWorkflowRunCreatedAt;
32+
const getWorkflowRunNumber = (run) => run.run_number;
33+
exports.getWorkflowRunNumber = getWorkflowRunNumber;
34+
const getWorkflowRuns = (workflowId, logger, octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
3135
const options = Object.assign(Object.assign({}, context.repo), { 'workflow_id': workflowId, status: 'in_progress' });
3236
const branch = yield misc_1.getTargetBranch(octokit, context);
3337
logger.log('target event: %s', logger.c(context.eventName, { color: 'green' }));
@@ -42,7 +46,9 @@ exports.getWorkflowRuns = (workflowId, logger, octokit, context) => __awaiter(vo
4246
// @ts-ignore
4347
options)).map(run => run).filter(run => run.event === context.eventName).filter(misc_1.isNotExcludeRun);
4448
});
49+
exports.getWorkflowRuns = getWorkflowRuns;
4550
// eslint-disable-next-line @typescript-eslint/no-explicit-any
46-
exports.cancelWorkflowRun = (runId, octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
51+
const cancelWorkflowRun = (runId, octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
4752
return octokit.actions.cancelWorkflowRun(Object.assign(Object.assign({}, context.repo), { 'run_id': runId }));
4853
});
54+
exports.cancelWorkflowRun = cancelWorkflowRun;

‎node_modules/.yarn-integrity

+53-52
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/@technote-space/github-action-helper/package.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/@technote-space/github-action-log-helper/package.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/@types/node/README.md

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/@types/node/assert.d.ts

+14-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/@types/node/package.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/@types/node/process.d.ts

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
This repository has been archived.