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

Commit 1c8e79c

Browse files
feat: build for release
1 parent 3ece94d commit 1c8e79c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"owner":"technote-space","repo":"auto-cancel-redundant-job","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v1.5.1","branch":"gh-actions","tags":["test/v1.5.1","test/v1.5","test/v1"],"updated_at":"2020-10-07T08:03:34.471Z"}
1+
{"owner":"technote-space","repo":"auto-cancel-redundant-job","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v1.5.1","branch":"gh-actions","tags":["test/v1.5.1","test/v1.5","test/v1"],"updated_at":"2020-10-07T08:45:20.366Z"}

lib/process.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ exports.execute = (logger, octokit, context) => __awaiter(void 0, void 0, void 0
3434
logger.log();
3535
const runsWithCreatedAtTime = runs.filter(run => run.id !== runId).map(run => (Object.assign(Object.assign({}, run), { createdAt: Date.parse(run.created_at) })));
3636
const createdAt = Date.parse(workflow_1.getWorkflowRunCreatedAt(run));
37-
if (runsWithCreatedAtTime.find(run => run.createdAt > createdAt)) {
37+
const runNumber = run.run_number;
38+
if (runsWithCreatedAtTime.find(run => run.createdAt > createdAt || (run.createdAt === createdAt && run.run_number > runNumber))) {
3839
logger.info(logger.c('newer job exists', { color: 'yellow' }));
3940
core_1.setOutput('ids', '');
4041
return;

lib/utils/workflow.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
99
});
1010
};
1111
Object.defineProperty(exports, "__esModule", { value: true });
12-
exports.cancelWorkflowRun = exports.getWorkflowRuns = exports.getWorkflowRunCreatedAt = exports.getWorkflowId = exports.getWorkflowRun = void 0;
12+
exports.cancelWorkflowRun = exports.getWorkflowRuns = exports.getWorkflowRunNumber = exports.getWorkflowRunCreatedAt = exports.getWorkflowId = exports.getWorkflowRun = void 0;
1313
const misc_1 = require("./misc");
1414
exports.getWorkflowRun = (octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
1515
return (yield octokit.actions.getWorkflowRun({
@@ -26,6 +26,7 @@ exports.getWorkflowId = (run) => {
2626
return Number(matches[0]);
2727
};
2828
exports.getWorkflowRunCreatedAt = (run) => run.created_at;
29+
exports.getWorkflowRunNumber = (run) => run.run_number;
2930
exports.getWorkflowRuns = (workflowId, logger, octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
3031
const options = Object.assign(Object.assign({}, context.repo), { 'workflow_id': workflowId, status: 'in_progress' });
3132
const branch = yield misc_1.getTargetBranch(octokit, context);

0 commit comments

Comments
 (0)