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

Commit 4036d12

Browse files
feat: build for release
1 parent 55be27e commit 4036d12

File tree

25 files changed

+24022
-22896
lines changed

25 files changed

+24022
-22896
lines changed

README.ja.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- [キャンセル中](#%E3%82%AD%E3%83%A3%E3%83%B3%E3%82%BB%E3%83%AB%E4%B8%AD)
2222
- [キャンセルされたジョブ](#%E3%82%AD%E3%83%A3%E3%83%B3%E3%82%BB%E3%83%AB%E3%81%95%E3%82%8C%E3%81%9F%E3%82%B8%E3%83%A7%E3%83%96)
2323
- [結果](#%E7%B5%90%E6%9E%9C)
24+
- [Outputs](#outputs)
2425
- [Author](#author)
2526

2627
</details>
@@ -40,14 +41,16 @@ jobs:
4041
name: Broken Link Check
4142
runs-on: ubuntu-latest
4243
steps:
44+
# use this GitHub Actions
4345
- uses: technote-space/auto-cancel-redundant-job@v1
44-
- name: Broken Link Check
45-
uses: technote-space/broken-link-checker-action@v1
46+
# Run any steps
47+
- name: any steps
48+
run: echo test
4649
```
4750
4851
e.g.
49-
- [ci.yml](.github/workflows/ci.yml)
50-
- [broken-link-check.yml](.github/workflows/broken-link-check.yml)
52+
- [ci.yml](https://github.com/technote-space/toc-generator/blob/master/.github/workflows/ci.yml)
53+
- [update-dependencies.yml](https://github.com/technote-space/toc-generator/blob/master/.github/workflows/update-dependencies.yml)
5154
5255
## スクリーンショット
5356
### キャンセル中
@@ -59,6 +62,11 @@ e.g.
5962
### 結果
6063
![result](https://raw.githubusercontent.com/technote-space/auto-cancel-redundant-job/images/result.png)
6164
65+
## Outputs
66+
| name | description | e.g. |
67+
|:---:|:---|:---:|
68+
|ids|キャンセルされた Run ID|`1234,2345`|
69+
6270
## Author
6371
[GitHub (Technote)](https://github.com/technote-space)
6472
[Blog](https://technote.space)

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ GitHub Actions to automatically cancel redundant jobs.
2121
- [Cancelling jobs](#cancelling-jobs)
2222
- [Cancelled job](#cancelled-job)
2323
- [Result](#result)
24+
- [Outputs](#outputs)
2425
- [Author](#author)
2526

2627
</details>
@@ -40,14 +41,16 @@ jobs:
4041
name: Broken Link Check
4142
runs-on: ubuntu-latest
4243
steps:
44+
# use this GitHub Actions
4345
- uses: technote-space/auto-cancel-redundant-job@v1
44-
- name: Broken Link Check
45-
uses: technote-space/broken-link-checker-action@v1
46+
# Run any steps
47+
- name: any steps
48+
run: echo test
4649
```
4750
4851
e.g.
49-
- [ci.yml](.github/workflows/ci.yml)
50-
- [broken-link-check.yml](.github/workflows/broken-link-check.yml)
52+
- [ci.yml](https://github.com/technote-space/toc-generator/blob/master/.github/workflows/ci.yml)
53+
- [update-dependencies.yml](https://github.com/technote-space/toc-generator/blob/master/.github/workflows/update-dependencies.yml)
5154
5255
## Screenshots
5356
### Cancelling jobs
@@ -59,6 +62,11 @@ e.g.
5962
### Result
6063
![result](https://raw.githubusercontent.com/technote-space/auto-cancel-redundant-job/images/result.png)
6164
65+
## Outputs
66+
| name | description | e.g. |
67+
|:---:|:---|:---:|
68+
|ids|The results of cancelled run ids.|`1234,2345`|
69+
6270
## Author
6371
[GitHub (Technote)](https://github.com/technote-space)
6472
[Blog](https://technote.space)

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":"bf9c133b7b118d1331cdb1f61f35edbe15c3aefd","ref":"refs/tags/v1.3.1","tagName":"v1.3.1","branch":"gh-actions","tags":["v1.3.1","v1.3","v1"],"updated_at":"2020-07-12T15:06:59.502Z"}
1+
{"owner":"technote-space","repo":"auto-cancel-redundant-job","sha":"f56a8a0c3fce02e9fa73eff05da053cca582974d","ref":"refs/tags/v1.4.0","tagName":"v1.4.0","branch":"gh-actions","tags":["v1.4.0","v1.4","v1"],"updated_at":"2020-07-16T15:00:07.521Z"}

lib/process.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
1010
};
1111
Object.defineProperty(exports, "__esModule", { value: true });
1212
exports.execute = void 0;
13+
const core_1 = require("@actions/core");
1314
const misc_1 = require("./utils/misc");
1415
const workflow_1 = require("./utils/workflow");
1516
exports.execute = (logger, octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
1617
if (misc_1.isExcludeContext(context)) {
1718
logger.info('This is not target context.');
19+
core_1.setOutput('ids', '');
1820
return;
1921
}
2022
const runId = misc_1.getRunId();
@@ -26,19 +28,22 @@ exports.execute = (logger, octokit, context) => __awaiter(void 0, void 0, void 0
2628
const currentRun = runs.find(run => run.id === runId);
2729
if (!currentRun) {
2830
logger.info(logger.c('current run not found', { color: 'yellow' }));
31+
core_1.setOutput('ids', '');
2932
return;
3033
}
3134
const runsWithCreatedAtTime = runs.filter(run => run.id !== runId).map(run => (Object.assign(Object.assign({}, run), { createdAt: Date.parse(run.created_at) })));
3235
const createdAt = Date.parse(currentRun.created_at);
3336
if (runsWithCreatedAtTime.find(run => run.createdAt > createdAt)) {
3437
logger.info(logger.c('newer job exists', { color: 'yellow' }));
38+
core_1.setOutput('ids', '');
3539
return;
3640
}
3741
logger.startProcess('Cancelling...');
3842
yield Promise.all(runsWithCreatedAtTime.map(run => {
3943
logger.log('cancel: %d', run.id);
40-
workflow_1.cancelWorkflowRun(run.id, octokit, context);
44+
return workflow_1.cancelWorkflowRun(run.id, octokit, context);
4145
}));
4246
logger.info('total: %d', runsWithCreatedAtTime.length);
47+
core_1.setOutput('ids', runsWithCreatedAtTime.map(run => run.id).join(','));
4348
logger.endProcess();
4449
});

0 commit comments

Comments
 (0)