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

Commit c89c89c

Browse files
Merge pull request #80 from technote-space/release/next-v1.7.4
release: v1.7.5
2 parents f26bd35 + 8ebb27b commit c89c89c

File tree

5 files changed

+432
-341
lines changed

5 files changed

+432
-341
lines changed

README.ja.md

+39
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
# Auto Cancel Redundant Workflow
22

3+
---
4+
5+
**Please note:** This repository is currently unmaintained by a team of developers at GitHub. The
6+
repository is here and you can use it as an example, or in Actions. However please be aware that
7+
we are not going to be updating issues or pull requests on this repository.
8+
9+
**注意:** このリポジトリはもうメンテナンスされません。
10+
代わりに公式から提供されている [concurrency](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency) を使用してください。
11+
12+
### 移行例
13+
14+
```yaml
15+
on: push
16+
jobs:
17+
test:
18+
steps:
19+
- uses: technote-space/auto-cancel-redundant-workflow@v1
20+
- run: echo step1
21+
- run: echo step2
22+
# ...
23+
```
24+
25+
26+
27+
```yaml
28+
on: push
29+
concurrency:
30+
group: ${{ github.workflow }}-${{ github.ref }}
31+
# cancel-in-progress: true
32+
jobs:
33+
test:
34+
steps:
35+
- run: echo step1
36+
- run: echo step2
37+
# ...
38+
```
39+
40+
---
41+
342
[![CI Status](https://github.com/technote-space/auto-cancel-redundant-workflow/workflows/CI/badge.svg)](https://github.com/technote-space/auto-cancel-redundant-workflow/actions)
443
[![codecov](https://codecov.io/gh/technote-space/auto-cancel-redundant-workflow/branch/master/graph/badge.svg)](https://codecov.io/gh/technote-space/auto-cancel-redundant-workflow)
544
[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/auto-cancel-redundant-workflow/badge)](https://www.codefactor.io/repository/github/technote-space/auto-cancel-redundant-workflow)

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# Auto Cancel Redundant Workflow
22

3+
---
4+
5+
**Please note:** This repository is no longer maintained.
6+
Please use the [concurrency](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency) provided by the officials instead.
7+
8+
### Example of migration
9+
10+
```yaml
11+
on: push
12+
jobs:
13+
test:
14+
steps:
15+
- uses: technote-space/auto-cancel-redundant-workflow@v1
16+
- run: echo step1
17+
- run: echo step2
18+
# ...
19+
```
20+
21+
22+
23+
```yaml
24+
on: push
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
# cancel-in-progress: true
28+
jobs:
29+
test:
30+
steps:
31+
- run: echo step1
32+
- run: echo step2
33+
# ...
34+
```
35+
36+
---
37+
338
[![CI Status](https://github.com/technote-space/auto-cancel-redundant-workflow/workflows/CI/badge.svg)](https://github.com/technote-space/auto-cancel-redundant-workflow/actions)
439
[![codecov](https://codecov.io/gh/technote-space/auto-cancel-redundant-workflow/branch/master/graph/badge.svg)](https://codecov.io/gh/technote-space/auto-cancel-redundant-workflow)
540
[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/auto-cancel-redundant-workflow/badge)](https://www.codefactor.io/repository/github/technote-space/auto-cancel-redundant-workflow)

package.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@technote-space/auto-cancel-redundant-workflow",
3-
"version": "1.7.4",
3+
"version": "1.7.5",
44
"description": "GitHub Actions to automatically cancel redundant workflow.",
55
"keywords": [
66
"github",
@@ -38,31 +38,31 @@
3838
},
3939
"dependencies": {
4040
"@actions/core": "^1.2.7",
41-
"@actions/github": "^4.0.0",
42-
"@octokit/openapi-types": "^6.2.1",
41+
"@actions/github": "^5.0.0",
42+
"@octokit/openapi-types": "^7.0.0",
4343
"@octokit/plugin-paginate-rest": "^2.13.3",
4444
"@octokit/plugin-rest-endpoint-methods": "^5.1.1",
45-
"@octokit/types": "^6.14.1",
46-
"@technote-space/github-action-helper": "^5.2.6",
47-
"@technote-space/github-action-log-helper": "^0.1.24"
45+
"@octokit/types": "^6.14.2",
46+
"@technote-space/github-action-helper": "^5.2.9",
47+
"@technote-space/github-action-log-helper": "^0.1.25"
4848
},
4949
"devDependencies": {
50-
"@commitlint/cli": "^12.1.1",
51-
"@commitlint/config-conventional": "^12.1.1",
52-
"@technote-space/github-action-test-helper": "^0.7.9",
50+
"@commitlint/cli": "^12.1.4",
51+
"@commitlint/config-conventional": "^12.1.4",
52+
"@technote-space/github-action-test-helper": "^0.7.12",
5353
"@technote-space/release-github-actions-cli": "^1.8.5",
5454
"@types/jest": "^26.0.23",
55-
"@types/node": "^15.0.1",
56-
"@typescript-eslint/eslint-plugin": "^4.22.0",
57-
"@typescript-eslint/parser": "^4.22.0",
58-
"eslint": "^7.25.0",
55+
"@types/node": "^15.3.0",
56+
"@typescript-eslint/eslint-plugin": "^4.23.0",
57+
"@typescript-eslint/parser": "^4.23.0",
58+
"eslint": "^7.26.0",
5959
"husky": "^6.0.0",
6060
"jest": "^26.6.3",
6161
"jest-circus": "^26.6.3",
62-
"lint-staged": "^10.5.4",
62+
"lint-staged": "^11.0.0",
6363
"nock": "^13.0.11",
6464
"pinst": "^2.1.6",
65-
"ts-jest": "^26.5.5",
65+
"ts-jest": "^26.5.6",
6666
"typescript": "^4.2.4"
6767
},
6868
"publishConfig": {

src/utils/workflow.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type {OctokitResponse} from '@octokit/types';
2-
import type {PaginateInterface} from '@octokit/plugin-paginate-rest';
32
import type {Octokit} from '@technote-space/github-action-helper/dist/types';
43
import type {Context} from '@actions/github/lib/context';
54
import type {Logger} from '@technote-space/github-action-log-helper';
@@ -11,7 +10,7 @@ type ActionsGetWorkflowRunResponseData = components['schemas']['workflow-run'];
1110
type ActionsListWorkflowRunsResponseData = components['schemas']['workflow-run'];
1211

1312
export const getWorkflowRun = async(runId: number, octokit: Octokit, context: Context): Promise<ActionsGetWorkflowRunResponseData> => {
14-
return (await octokit.actions.getWorkflowRun({
13+
return (await octokit.rest.actions.getWorkflowRun({
1514
owner: context.repo.owner,
1615
repo: context.repo.repo,
1716
'run_id': runId,
@@ -54,8 +53,8 @@ export const getWorkflowRuns = async(workflowId: number, logger: Logger, octokit
5453
options.branch = branch;
5554
}
5655

57-
return (await (octokit.paginate as PaginateInterface)(
58-
octokit.actions.listWorkflowRuns,
56+
return (await octokit.paginate(
57+
octokit.rest.actions.listWorkflowRuns,
5958
// eslint-disable-next-line no-warning-comments
6059
// TODO: remove ts-ignore after fixed types (https://github.com/octokit/types.ts/issues/122)
6160
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -64,7 +63,7 @@ export const getWorkflowRuns = async(workflowId: number, logger: Logger, octokit
6463
)).map(run => run as ActionsListWorkflowRunsResponseData).filter(run => run.event === context.eventName).filter(isNotExcludeRun);
6564
};
6665

67-
export const cancelWorkflowRun = async(runId: number, octokit: Octokit, context: Context): Promise<OctokitResponse<{ [key: string]: unknown; }>> => octokit.actions.cancelWorkflowRun({
66+
export const cancelWorkflowRun = async(runId: number, octokit: Octokit, context: Context): Promise<OctokitResponse<{ [key: string]: unknown; }>> => octokit.rest.actions.cancelWorkflowRun({
6867
...context.repo,
6968
'run_id': runId,
7069
});

0 commit comments

Comments
 (0)