accept-to-ship-action 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +147 -0
- package/lib/getCheckRuns.d.ts +162 -0
- package/lib/getCheckRuns.js +23 -0
- package/lib/getMergeMethod.d.ts +1 -0
- package/lib/getMergeMethod.js +14 -0
- package/lib/getOcktokit.d.ts +7 -0
- package/lib/getOcktokit.js +40 -0
- package/lib/getPullRequest.d.ts +4 -0
- package/lib/getPullRequest.js +23 -0
- package/lib/getPullRequestComments.d.ts +75 -0
- package/lib/getPullRequestComments.js +23 -0
- package/lib/getPullRequestReviewRequests.d.ts +61 -0
- package/lib/getPullRequestReviewRequests.js +23 -0
- package/lib/getPullRequestReviews.d.ts +46 -0
- package/lib/getPullRequestReviews.js +23 -0
- package/lib/getWorkflowRunJobs.d.ts +31 -0
- package/lib/getWorkflowRunJobs.js +24 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +283 -0
- package/lib/mergePullRequest.d.ts +5 -0
- package/lib/mergePullRequest.js +54 -0
- package/lib/sleep.d.ts +1 -0
- package/lib/sleep.js +20 -0
- package/lib/updateCheckRun.d.ts +4 -0
- package/lib/updateCheckRun.js +23 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Cat Chen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# accept-to-ship-action
|
|
2
|
+
|
|
3
|
+
[](https://github.com/CatChen/accept-to-ship-action/actions/workflows/build.yml)
|
|
4
|
+
[](https://github.com/CatChen/accept-to-ship-action/actions/workflows/test.yml)
|
|
5
|
+
[](https://github.com/CatChen/accept-to-ship-action/actions/workflows/eslint.yml)
|
|
6
|
+
[](https://github.com/CatChen/accept-to-ship-action/actions/workflows/codeql.yml)
|
|
7
|
+
[](https://github.com/CatChen/accept-to-ship-action/actions/workflows/ship.yml)
|
|
8
|
+
|
|
9
|
+
Want to merge a Pull Request automatically after someone approved it? Set up this Action and add a `#accept2ship` hashtag to the Pull Request. It will be merged automatically without involving you or the approver.
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
name: Ship
|
|
15
|
+
|
|
16
|
+
on:
|
|
17
|
+
pull_request:
|
|
18
|
+
types:
|
|
19
|
+
[
|
|
20
|
+
labeled,
|
|
21
|
+
unlabeled,
|
|
22
|
+
edited,
|
|
23
|
+
closed,
|
|
24
|
+
reopened,
|
|
25
|
+
synchronize,
|
|
26
|
+
review_requested,
|
|
27
|
+
review_request_removed,
|
|
28
|
+
]
|
|
29
|
+
pull_request_review:
|
|
30
|
+
types: [submitted, edited, dismissed]
|
|
31
|
+
check_run:
|
|
32
|
+
type: [created, rerequested, completed]
|
|
33
|
+
check_suite:
|
|
34
|
+
types: [completed]
|
|
35
|
+
workflow_run:
|
|
36
|
+
workflows: []
|
|
37
|
+
types: [completed]
|
|
38
|
+
|
|
39
|
+
concurrency:
|
|
40
|
+
group: ${{ github.event.pull_request.number || github.workflow }}
|
|
41
|
+
cancel-in-progress: true
|
|
42
|
+
|
|
43
|
+
jobs:
|
|
44
|
+
accept_to_ship:
|
|
45
|
+
name: Accept to Ship
|
|
46
|
+
if: |-
|
|
47
|
+
${{
|
|
48
|
+
github.base_ref == 'main' ||
|
|
49
|
+
github.event.pull_request.base.ref == 'main' ||
|
|
50
|
+
contains(github.event.check_run.pull_requests.*.base.ref, 'main') ||
|
|
51
|
+
contains(github.event.check_suite.pull_requests.*.base.ref, 'main') ||
|
|
52
|
+
contains(github.event.workflow_run.pull_requests.*.base.ref, 'main')
|
|
53
|
+
}}
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v3
|
|
57
|
+
|
|
58
|
+
- uses: CatChen/accept-to-ship-action@v0.2.0
|
|
59
|
+
with:
|
|
60
|
+
github-token: ${{ secrets.GITHUB_TOKEN }} # optional
|
|
61
|
+
merge-method: merge # optional
|
|
62
|
+
timeout: 0 # optional
|
|
63
|
+
checks-watch-interval: 10 # optional
|
|
64
|
+
fail-if-timeout: false # optinal
|
|
65
|
+
request-zero-accept-zero: false # optional
|
|
66
|
+
custom-hashtag: "#accept2ship" #optional
|
|
67
|
+
|
|
68
|
+
pass-to-ship:
|
|
69
|
+
name: Pass to Ship
|
|
70
|
+
if: |-
|
|
71
|
+
${{
|
|
72
|
+
github.base_ref == 'main' ||
|
|
73
|
+
github.event.pull_request.base.ref == 'main' ||
|
|
74
|
+
contains(github.event.check_run.pull_requests.*.base.ref, 'main') ||
|
|
75
|
+
contains(github.event.check_suite.pull_requests.*.base.ref, 'main') ||
|
|
76
|
+
contains(github.event.workflow_run.pull_requests.*.base.ref, 'main')
|
|
77
|
+
}}
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
permissions: write-all
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v3
|
|
82
|
+
|
|
83
|
+
- uses: ./
|
|
84
|
+
with:
|
|
85
|
+
request-zero-accept-zero: true
|
|
86
|
+
custom-hashtag: "#pass2ship"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Options
|
|
90
|
+
|
|
91
|
+
### `github-token`
|
|
92
|
+
|
|
93
|
+
The default value is `${{ github.token }}`, which is the GitHub token generated for this workflow. You can [create a different token with a different set of permissions](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) and use it here as well.
|
|
94
|
+
|
|
95
|
+
### `merge-method`
|
|
96
|
+
|
|
97
|
+
The merge method to use when this Action is triggered. Possible values are `merge`, `squash` or `rebase`. The default value is `merge`.
|
|
98
|
+
|
|
99
|
+
### `timeout`
|
|
100
|
+
|
|
101
|
+
How much time to wait for checks before giving up. This needs to be an integer in seconds. The default value is `0`.
|
|
102
|
+
|
|
103
|
+
### `checks-watch-interval`
|
|
104
|
+
|
|
105
|
+
How much time to wait before refreshing the checks again before they are completed. This needs to be an integer in seconds. The default value is `10` seconds.
|
|
106
|
+
|
|
107
|
+
### `fail-if-timeout`
|
|
108
|
+
|
|
109
|
+
When this option is set to `true` this Action will fail if its execution time (including the time waiting for checks) exceeds the value set in `timeout`.
|
|
110
|
+
|
|
111
|
+
### `custom-hashtag`
|
|
112
|
+
|
|
113
|
+
Change `#accept2ship` to another hashtag. Use multiple instances of this Action with different configurations and different hashtags. The default value is `#accept2ship`.
|
|
114
|
+
|
|
115
|
+
### `request-zero-accept-zero`
|
|
116
|
+
|
|
117
|
+
When this option is set to `true` this Action will not wait for any approval if no review was requested. Otherwise, this Action will wait for at least one approval if no review was requested. It's useful to set this to `true` with a different hashtag set in `custom-hashtag` to merge certain Pull Requests after running and passing all the checks. See the `#pass2ship` configuration in the examples from above. The default value is `false`.
|
|
118
|
+
|
|
119
|
+
## FAQ
|
|
120
|
+
|
|
121
|
+
### Where do I need to put the `#accept2ship` hashtag?
|
|
122
|
+
|
|
123
|
+
It can be in a Pull Request's title, body or comment. When it's in a comment the comment needs to have the same author as the Pull Request. (Option to allow `#accept2ship` in any comment is in the roadmap.)
|
|
124
|
+
|
|
125
|
+
It can be a Label named `accept2ship` as well. No `#` sign in this case.
|
|
126
|
+
|
|
127
|
+
### When is a Pull Request considered approved by this Action?
|
|
128
|
+
|
|
129
|
+
If reviewers are requested this Action waits for approvals from all requested reviewers. (Team reviewers are ignored in the current version. Support for team reviewers is on the roadmap.)
|
|
130
|
+
|
|
131
|
+
If no reviewer is requested then any approval is enough.
|
|
132
|
+
|
|
133
|
+
### Does this Action wait for other checks?
|
|
134
|
+
|
|
135
|
+
Yes. It waits for other checks. Other checks need to be completed and their conclusions have to be either "success", "neutral" or "skipped". (The options to configurate check requirements may be added in the future.)
|
|
136
|
+
|
|
137
|
+
The check from the Workflow that runs this Action doesn't count. It will always be in progress without conclusion when this Action is running. This Action ignores the Workflow instance that's running this Action and all instances of the same Workflow.
|
|
138
|
+
|
|
139
|
+
### The successful completion of my other Workflow doesn't trigger this Workflow.
|
|
140
|
+
|
|
141
|
+
> When you use the repository's `GITHUB_TOKEN` to perform tasks, events triggered by the `GITHUB_TOKEN` will not create a new workflow run. This prevents you from accidentally creating recursive workflow runs. -- [Source](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)
|
|
142
|
+
|
|
143
|
+
Please list your other Workflows in the `workflows` field under the `workflow_run` trigger. Put them into the empty bracket in the example from above. When they complete they will trigger this Action.
|
|
144
|
+
|
|
145
|
+
### How do I use Action this with stacked Pull Requests?
|
|
146
|
+
|
|
147
|
+
Limit this Action to the branches that are directly based on the main branch (usually `main` or `master`). It will merge the bottom Pull Request to the main branch. The Pull Request right above that will become the new bottom Pull Request. This Action will start merging that Pull Request, too. This process will continue itself until all mergeable Pull Requests in the stack are merged. See the `jobs.accept-to-ship.if` block in the example from above as a reference.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Octokit } from "@octokit/core";
|
|
2
|
+
import { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
|
|
3
|
+
export declare function getCheckRuns(owner: string, repo: string, ref: string, octokit: Octokit & Api): Promise<{
|
|
4
|
+
id: number;
|
|
5
|
+
head_sha: string;
|
|
6
|
+
node_id: string;
|
|
7
|
+
external_id: string | null;
|
|
8
|
+
url: string;
|
|
9
|
+
html_url: string | null;
|
|
10
|
+
details_url: string | null;
|
|
11
|
+
status: "completed" | "queued" | "in_progress";
|
|
12
|
+
conclusion: "success" | "neutral" | "skipped" | "failure" | "cancelled" | "timed_out" | "action_required" | null;
|
|
13
|
+
started_at: string | null;
|
|
14
|
+
completed_at: string | null;
|
|
15
|
+
output: {
|
|
16
|
+
title: string | null;
|
|
17
|
+
summary: string | null;
|
|
18
|
+
text: string | null;
|
|
19
|
+
annotations_count: number;
|
|
20
|
+
annotations_url: string;
|
|
21
|
+
};
|
|
22
|
+
name: string;
|
|
23
|
+
check_suite: {
|
|
24
|
+
id: number;
|
|
25
|
+
} | null;
|
|
26
|
+
app: {
|
|
27
|
+
id: number;
|
|
28
|
+
slug?: string | undefined;
|
|
29
|
+
node_id: string;
|
|
30
|
+
owner: {
|
|
31
|
+
name?: string | null | undefined;
|
|
32
|
+
email?: string | null | undefined;
|
|
33
|
+
login: string;
|
|
34
|
+
id: number;
|
|
35
|
+
node_id: string;
|
|
36
|
+
avatar_url: string;
|
|
37
|
+
gravatar_id: string | null;
|
|
38
|
+
url: string;
|
|
39
|
+
html_url: string;
|
|
40
|
+
followers_url: string;
|
|
41
|
+
following_url: string;
|
|
42
|
+
gists_url: string;
|
|
43
|
+
starred_url: string;
|
|
44
|
+
subscriptions_url: string;
|
|
45
|
+
organizations_url: string;
|
|
46
|
+
repos_url: string;
|
|
47
|
+
events_url: string;
|
|
48
|
+
received_events_url: string;
|
|
49
|
+
type: string;
|
|
50
|
+
site_admin: boolean;
|
|
51
|
+
starred_at?: string | undefined;
|
|
52
|
+
} | null;
|
|
53
|
+
name: string;
|
|
54
|
+
description: string | null;
|
|
55
|
+
external_url: string;
|
|
56
|
+
html_url: string;
|
|
57
|
+
created_at: string;
|
|
58
|
+
updated_at: string;
|
|
59
|
+
permissions: {
|
|
60
|
+
issues?: string | undefined;
|
|
61
|
+
checks?: string | undefined;
|
|
62
|
+
metadata?: string | undefined;
|
|
63
|
+
contents?: string | undefined;
|
|
64
|
+
deployments?: string | undefined;
|
|
65
|
+
} & {
|
|
66
|
+
[key: string]: string;
|
|
67
|
+
};
|
|
68
|
+
events: string[];
|
|
69
|
+
installations_count?: number | undefined;
|
|
70
|
+
client_id?: string | undefined;
|
|
71
|
+
client_secret?: string | undefined;
|
|
72
|
+
webhook_secret?: string | null | undefined;
|
|
73
|
+
pem?: string | undefined;
|
|
74
|
+
} | null;
|
|
75
|
+
pull_requests: {
|
|
76
|
+
id: number;
|
|
77
|
+
number: number;
|
|
78
|
+
url: string;
|
|
79
|
+
head: {
|
|
80
|
+
ref: string;
|
|
81
|
+
sha: string;
|
|
82
|
+
repo: {
|
|
83
|
+
id: number;
|
|
84
|
+
url: string;
|
|
85
|
+
name: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
base: {
|
|
89
|
+
ref: string;
|
|
90
|
+
sha: string;
|
|
91
|
+
repo: {
|
|
92
|
+
id: number;
|
|
93
|
+
url: string;
|
|
94
|
+
name: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}[];
|
|
98
|
+
deployment?: {
|
|
99
|
+
url: string;
|
|
100
|
+
id: number;
|
|
101
|
+
node_id: string;
|
|
102
|
+
task: string;
|
|
103
|
+
original_environment?: string | undefined;
|
|
104
|
+
environment: string;
|
|
105
|
+
description: string | null;
|
|
106
|
+
created_at: string;
|
|
107
|
+
updated_at: string;
|
|
108
|
+
statuses_url: string;
|
|
109
|
+
repository_url: string;
|
|
110
|
+
transient_environment?: boolean | undefined;
|
|
111
|
+
production_environment?: boolean | undefined;
|
|
112
|
+
performed_via_github_app?: {
|
|
113
|
+
id: number;
|
|
114
|
+
slug?: string | undefined;
|
|
115
|
+
node_id: string;
|
|
116
|
+
owner: {
|
|
117
|
+
name?: string | null | undefined;
|
|
118
|
+
email?: string | null | undefined;
|
|
119
|
+
login: string;
|
|
120
|
+
id: number;
|
|
121
|
+
node_id: string;
|
|
122
|
+
avatar_url: string;
|
|
123
|
+
gravatar_id: string | null;
|
|
124
|
+
url: string;
|
|
125
|
+
html_url: string;
|
|
126
|
+
followers_url: string;
|
|
127
|
+
following_url: string;
|
|
128
|
+
gists_url: string;
|
|
129
|
+
starred_url: string;
|
|
130
|
+
subscriptions_url: string;
|
|
131
|
+
organizations_url: string;
|
|
132
|
+
repos_url: string;
|
|
133
|
+
events_url: string;
|
|
134
|
+
received_events_url: string;
|
|
135
|
+
type: string;
|
|
136
|
+
site_admin: boolean;
|
|
137
|
+
starred_at?: string | undefined;
|
|
138
|
+
} | null;
|
|
139
|
+
name: string;
|
|
140
|
+
description: string | null;
|
|
141
|
+
external_url: string;
|
|
142
|
+
html_url: string;
|
|
143
|
+
created_at: string;
|
|
144
|
+
updated_at: string;
|
|
145
|
+
permissions: {
|
|
146
|
+
issues?: string | undefined;
|
|
147
|
+
checks?: string | undefined;
|
|
148
|
+
metadata?: string | undefined;
|
|
149
|
+
contents?: string | undefined;
|
|
150
|
+
deployments?: string | undefined;
|
|
151
|
+
} & {
|
|
152
|
+
[key: string]: string;
|
|
153
|
+
};
|
|
154
|
+
events: string[];
|
|
155
|
+
installations_count?: number | undefined;
|
|
156
|
+
client_id?: string | undefined;
|
|
157
|
+
client_secret?: string | undefined;
|
|
158
|
+
webhook_secret?: string | null | undefined;
|
|
159
|
+
pem?: string | undefined;
|
|
160
|
+
} | null | undefined;
|
|
161
|
+
} | undefined;
|
|
162
|
+
}[]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getCheckRuns = void 0;
|
|
13
|
+
function getCheckRuns(owner, repo, ref, octokit) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const response = yield octokit.rest.checks.listForRef({
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
ref,
|
|
19
|
+
});
|
|
20
|
+
return response.data.check_runs;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.getCheckRuns = getCheckRuns;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getMergeMethod(): "merge" | "squash" | "rebase";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMergeMethod = void 0;
|
|
4
|
+
const core_1 = require("@actions/core");
|
|
5
|
+
function getMergeMethod() {
|
|
6
|
+
const mergeMethod = (0, core_1.getInput)("merge-method");
|
|
7
|
+
if (mergeMethod !== "merge" &&
|
|
8
|
+
mergeMethod !== "squash" &&
|
|
9
|
+
mergeMethod !== "rebase") {
|
|
10
|
+
throw new Error(`Unsupported merge-method: ${mergeMethod}`);
|
|
11
|
+
}
|
|
12
|
+
return mergeMethod;
|
|
13
|
+
}
|
|
14
|
+
exports.getMergeMethod = getMergeMethod;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getOctokit(): import("@octokit/core").Octokit & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
|
2
|
+
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
|
3
|
+
} & {
|
|
4
|
+
retry: {
|
|
5
|
+
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOctokit = void 0;
|
|
4
|
+
const utils_1 = require("@actions/github/lib/utils");
|
|
5
|
+
const core_1 = require("@actions/core");
|
|
6
|
+
const plugin_throttling_1 = require("@octokit/plugin-throttling");
|
|
7
|
+
const plugin_retry_1 = require("@octokit/plugin-retry");
|
|
8
|
+
function getOctokit() {
|
|
9
|
+
const githubToken = (0, core_1.getInput)("github-token");
|
|
10
|
+
const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_retry_1.retry);
|
|
11
|
+
const octokit = new Octokit((0, utils_1.getOctokitOptions)(githubToken, {
|
|
12
|
+
throttle: {
|
|
13
|
+
onRateLimit: (retryAfter, options) => {
|
|
14
|
+
if (options.request.retryCount === 0) {
|
|
15
|
+
octokit.log.warn(`Request quota exhausted for request ${options.method} ${options.url}`);
|
|
16
|
+
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
octokit.log.error(`Request quota exhausted for request ${options.method} ${options.url}`);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
onSecondaryRateLimit: (retryAfter, options) => {
|
|
24
|
+
if (options.request.retryCount === 0) {
|
|
25
|
+
octokit.log.warn(`Abuse detected for request ${options.method} ${options.url}`);
|
|
26
|
+
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
octokit.log.warn(`Abuse detected for request ${options.method} ${options.url}`);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
retry: {
|
|
35
|
+
doNotRetry: ["429"],
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
return octokit;
|
|
39
|
+
}
|
|
40
|
+
exports.getOctokit = getOctokit;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Octokit } from "@octokit/core";
|
|
2
|
+
import { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
|
|
3
|
+
import { PullRequest } from "@octokit/webhooks-definitions/schema";
|
|
4
|
+
export declare function getPullRequest(owner: string, repo: string, pullRequestNumber: number, octokit: Octokit & Api): Promise<PullRequest>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getPullRequest = void 0;
|
|
13
|
+
function getPullRequest(owner, repo, pullRequestNumber, octokit) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const response = yield octokit.rest.pulls.get({
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
pull_number: pullRequestNumber,
|
|
19
|
+
});
|
|
20
|
+
return response.data;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.getPullRequest = getPullRequest;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Octokit } from "@octokit/core";
|
|
2
|
+
import { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
|
|
3
|
+
export declare function getPullRequestComments(owner: string, repo: string, pullRequestNumber: number, octokit: Octokit & Api): Promise<{
|
|
4
|
+
url: string;
|
|
5
|
+
pull_request_review_id: number | null;
|
|
6
|
+
id: number;
|
|
7
|
+
node_id: string;
|
|
8
|
+
diff_hunk: string;
|
|
9
|
+
path: string;
|
|
10
|
+
position: number | null;
|
|
11
|
+
original_position: number;
|
|
12
|
+
commit_id: string;
|
|
13
|
+
original_commit_id: string;
|
|
14
|
+
in_reply_to_id?: number | undefined;
|
|
15
|
+
user: {
|
|
16
|
+
name?: string | null | undefined;
|
|
17
|
+
email?: string | null | undefined;
|
|
18
|
+
login: string;
|
|
19
|
+
id: number;
|
|
20
|
+
node_id: string;
|
|
21
|
+
avatar_url: string;
|
|
22
|
+
gravatar_id: string | null;
|
|
23
|
+
url: string;
|
|
24
|
+
html_url: string;
|
|
25
|
+
followers_url: string;
|
|
26
|
+
following_url: string;
|
|
27
|
+
gists_url: string;
|
|
28
|
+
starred_url: string;
|
|
29
|
+
subscriptions_url: string;
|
|
30
|
+
organizations_url: string;
|
|
31
|
+
repos_url: string;
|
|
32
|
+
events_url: string;
|
|
33
|
+
received_events_url: string;
|
|
34
|
+
type: string;
|
|
35
|
+
site_admin: boolean;
|
|
36
|
+
starred_at?: string | undefined;
|
|
37
|
+
} | null;
|
|
38
|
+
body: string;
|
|
39
|
+
created_at: string;
|
|
40
|
+
updated_at: string;
|
|
41
|
+
html_url: string;
|
|
42
|
+
pull_request_url: string;
|
|
43
|
+
author_association: "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER";
|
|
44
|
+
_links: {
|
|
45
|
+
self: {
|
|
46
|
+
href: string;
|
|
47
|
+
};
|
|
48
|
+
html: {
|
|
49
|
+
href: string;
|
|
50
|
+
};
|
|
51
|
+
pull_request: {
|
|
52
|
+
href: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
body_text?: string | undefined;
|
|
56
|
+
body_html?: string | undefined;
|
|
57
|
+
reactions?: {
|
|
58
|
+
url: string;
|
|
59
|
+
total_count: number;
|
|
60
|
+
"+1": number;
|
|
61
|
+
"-1": number;
|
|
62
|
+
laugh: number;
|
|
63
|
+
confused: number;
|
|
64
|
+
heart: number;
|
|
65
|
+
hooray: number;
|
|
66
|
+
eyes: number;
|
|
67
|
+
rocket: number;
|
|
68
|
+
} | undefined;
|
|
69
|
+
side?: "LEFT" | "RIGHT" | undefined;
|
|
70
|
+
start_side?: "LEFT" | "RIGHT" | null | undefined;
|
|
71
|
+
line?: number | undefined;
|
|
72
|
+
original_line?: number | undefined;
|
|
73
|
+
start_line?: number | null | undefined;
|
|
74
|
+
original_start_line?: number | null | undefined;
|
|
75
|
+
}[]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getPullRequestComments = void 0;
|
|
13
|
+
function getPullRequestComments(owner, repo, pullRequestNumber, octokit) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const response = yield octokit.rest.pulls.listReviewComments({
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
pull_number: pullRequestNumber,
|
|
19
|
+
});
|
|
20
|
+
return response.data;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.getPullRequestComments = getPullRequestComments;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Octokit } from "@octokit/core";
|
|
2
|
+
import { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
|
|
3
|
+
export declare function getPullRequestReviewRequests(owner: string, repo: string, pullRequestNumber: number, octokit: Octokit & Api): Promise<{
|
|
4
|
+
users: {
|
|
5
|
+
name?: string | null | undefined;
|
|
6
|
+
email?: string | null | undefined;
|
|
7
|
+
login: string;
|
|
8
|
+
id: number;
|
|
9
|
+
node_id: string;
|
|
10
|
+
avatar_url: string;
|
|
11
|
+
gravatar_id: string | null;
|
|
12
|
+
url: string;
|
|
13
|
+
html_url: string;
|
|
14
|
+
followers_url: string;
|
|
15
|
+
following_url: string;
|
|
16
|
+
gists_url: string;
|
|
17
|
+
starred_url: string;
|
|
18
|
+
subscriptions_url: string;
|
|
19
|
+
organizations_url: string;
|
|
20
|
+
repos_url: string;
|
|
21
|
+
events_url: string;
|
|
22
|
+
received_events_url: string;
|
|
23
|
+
type: string;
|
|
24
|
+
site_admin: boolean;
|
|
25
|
+
starred_at?: string | undefined;
|
|
26
|
+
}[];
|
|
27
|
+
teams: {
|
|
28
|
+
id: number;
|
|
29
|
+
node_id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
slug: string;
|
|
32
|
+
description: string | null;
|
|
33
|
+
privacy?: string | undefined;
|
|
34
|
+
permission: string;
|
|
35
|
+
permissions?: {
|
|
36
|
+
pull: boolean;
|
|
37
|
+
triage: boolean;
|
|
38
|
+
push: boolean;
|
|
39
|
+
maintain: boolean;
|
|
40
|
+
admin: boolean;
|
|
41
|
+
} | undefined;
|
|
42
|
+
url: string;
|
|
43
|
+
html_url: string;
|
|
44
|
+
members_url: string;
|
|
45
|
+
repositories_url: string;
|
|
46
|
+
parent: {
|
|
47
|
+
id: number;
|
|
48
|
+
node_id: string;
|
|
49
|
+
url: string;
|
|
50
|
+
members_url: string;
|
|
51
|
+
name: string;
|
|
52
|
+
description: string | null;
|
|
53
|
+
permission: string;
|
|
54
|
+
privacy?: string | undefined;
|
|
55
|
+
html_url: string;
|
|
56
|
+
repositories_url: string;
|
|
57
|
+
slug: string;
|
|
58
|
+
ldap_dn?: string | undefined;
|
|
59
|
+
} | null;
|
|
60
|
+
}[];
|
|
61
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getPullRequestReviewRequests = void 0;
|
|
13
|
+
function getPullRequestReviewRequests(owner, repo, pullRequestNumber, octokit) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const response = yield octokit.rest.pulls.listRequestedReviewers({
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
pull_number: pullRequestNumber,
|
|
19
|
+
});
|
|
20
|
+
return response.data;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.getPullRequestReviewRequests = getPullRequestReviewRequests;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Octokit } from "@octokit/core";
|
|
2
|
+
import { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
|
|
3
|
+
export declare function getPullRequestReviews(owner: string, repo: string, pullRequestNumber: number, octokit: Octokit & Api): Promise<{
|
|
4
|
+
id: number;
|
|
5
|
+
node_id: string;
|
|
6
|
+
user: {
|
|
7
|
+
name?: string | null | undefined;
|
|
8
|
+
email?: string | null | undefined;
|
|
9
|
+
login: string;
|
|
10
|
+
id: number;
|
|
11
|
+
node_id: string;
|
|
12
|
+
avatar_url: string;
|
|
13
|
+
gravatar_id: string | null;
|
|
14
|
+
url: string;
|
|
15
|
+
html_url: string;
|
|
16
|
+
followers_url: string;
|
|
17
|
+
following_url: string;
|
|
18
|
+
gists_url: string;
|
|
19
|
+
starred_url: string;
|
|
20
|
+
subscriptions_url: string;
|
|
21
|
+
organizations_url: string;
|
|
22
|
+
repos_url: string;
|
|
23
|
+
events_url: string;
|
|
24
|
+
received_events_url: string;
|
|
25
|
+
type: string;
|
|
26
|
+
site_admin: boolean;
|
|
27
|
+
starred_at?: string | undefined;
|
|
28
|
+
} | null;
|
|
29
|
+
body: string;
|
|
30
|
+
state: string;
|
|
31
|
+
html_url: string;
|
|
32
|
+
pull_request_url: string;
|
|
33
|
+
_links: {
|
|
34
|
+
html: {
|
|
35
|
+
href: string;
|
|
36
|
+
};
|
|
37
|
+
pull_request: {
|
|
38
|
+
href: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
submitted_at?: string | undefined;
|
|
42
|
+
commit_id: string;
|
|
43
|
+
body_html?: string | undefined;
|
|
44
|
+
body_text?: string | undefined;
|
|
45
|
+
author_association: "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER";
|
|
46
|
+
}[]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getPullRequestReviews = void 0;
|
|
13
|
+
function getPullRequestReviews(owner, repo, pullRequestNumber, octokit) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const response = yield octokit.rest.pulls.listReviews({
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
pull_number: pullRequestNumber,
|
|
19
|
+
});
|
|
20
|
+
return response.data;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.getPullRequestReviews = getPullRequestReviews;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Octokit } from "@octokit/core";
|
|
2
|
+
import { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
|
|
3
|
+
export declare function getWorkflowRunJobs(owner: string, repo: string, octokit: Octokit & Api): Promise<{
|
|
4
|
+
id: number;
|
|
5
|
+
run_id: number;
|
|
6
|
+
run_url: string;
|
|
7
|
+
run_attempt?: number | undefined;
|
|
8
|
+
node_id: string;
|
|
9
|
+
head_sha: string;
|
|
10
|
+
url: string;
|
|
11
|
+
html_url: string | null;
|
|
12
|
+
status: "completed" | "queued" | "in_progress";
|
|
13
|
+
conclusion: string | null;
|
|
14
|
+
started_at: string;
|
|
15
|
+
completed_at: string | null;
|
|
16
|
+
name: string;
|
|
17
|
+
steps?: {
|
|
18
|
+
status: "completed" | "queued" | "in_progress";
|
|
19
|
+
conclusion: string | null;
|
|
20
|
+
name: string;
|
|
21
|
+
number: number;
|
|
22
|
+
started_at?: string | null | undefined;
|
|
23
|
+
completed_at?: string | null | undefined;
|
|
24
|
+
}[] | undefined;
|
|
25
|
+
check_run_url: string;
|
|
26
|
+
labels: string[];
|
|
27
|
+
runner_id: number | null;
|
|
28
|
+
runner_name: string | null;
|
|
29
|
+
runner_group_id: number | null;
|
|
30
|
+
runner_group_name: string | null;
|
|
31
|
+
}[]>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getWorkflowRunJobs = void 0;
|
|
13
|
+
const github_1 = require("@actions/github");
|
|
14
|
+
function getWorkflowRunJobs(owner, repo, octokit) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const response = yield octokit.rest.actions.listJobsForWorkflowRun({
|
|
17
|
+
owner,
|
|
18
|
+
repo,
|
|
19
|
+
run_id: github_1.context.runId,
|
|
20
|
+
});
|
|
21
|
+
return response.data.jobs;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.getWorkflowRunJobs = getWorkflowRunJobs;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const github_1 = require("@actions/github");
|
|
13
|
+
const core_1 = require("@actions/core");
|
|
14
|
+
const getOcktokit_1 = require("./getOcktokit");
|
|
15
|
+
const getMergeMethod_1 = require("./getMergeMethod");
|
|
16
|
+
const getPullRequest_1 = require("./getPullRequest");
|
|
17
|
+
const getPullRequestComments_1 = require("./getPullRequestComments");
|
|
18
|
+
const getPullRequestReviewRequests_1 = require("./getPullRequestReviewRequests");
|
|
19
|
+
const getPullRequestReviews_1 = require("./getPullRequestReviews");
|
|
20
|
+
const getWorkflowRunJobs_1 = require("./getWorkflowRunJobs");
|
|
21
|
+
const getCheckRuns_1 = require("./getCheckRuns");
|
|
22
|
+
const mergePullRequest_1 = require("./mergePullRequest");
|
|
23
|
+
const sleep_1 = require("./sleep");
|
|
24
|
+
const node_perf_hooks_1 = require("node:perf_hooks");
|
|
25
|
+
const APPROVED = "APPROVED";
|
|
26
|
+
const CHANGES_REQUESTED = "CHANGES_REQUESTED";
|
|
27
|
+
const COMPLETED = "completed";
|
|
28
|
+
const SUCCESS = "success";
|
|
29
|
+
const NEUTRAL = "neutral";
|
|
30
|
+
const SKIPPED = "skipped";
|
|
31
|
+
const LOCALE = Intl.NumberFormat().resolvedOptions().locale;
|
|
32
|
+
const FORMATTER = new Intl.NumberFormat(LOCALE, {
|
|
33
|
+
style: "unit",
|
|
34
|
+
unit: "second",
|
|
35
|
+
unitDisplay: "long",
|
|
36
|
+
});
|
|
37
|
+
function handlePullRequest(pullRequestNumber) {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
(0, core_1.startGroup)(`Pull Request number: ${pullRequestNumber}`);
|
|
41
|
+
const octokit = (0, getOcktokit_1.getOctokit)();
|
|
42
|
+
const owner = github_1.context.repo.owner;
|
|
43
|
+
const repo = github_1.context.repo.repo;
|
|
44
|
+
const mergedBeforeValidations = yield (0, mergePullRequest_1.checkIfPullRequestMerged)(owner, repo, pullRequestNumber, octokit);
|
|
45
|
+
if (mergedBeforeValidations) {
|
|
46
|
+
(0, core_1.error)(`This Pull Request has been merged already.`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const customHashTag = (0, core_1.getInput)("custom-hashtag") || "#accept2ship";
|
|
50
|
+
const hashTagLabel = customHashTag.replace(/^#*/, "");
|
|
51
|
+
const hashTag = `#${hashTagLabel}`;
|
|
52
|
+
const pullRequest = yield (0, getPullRequest_1.getPullRequest)(owner, repo, pullRequestNumber, octokit);
|
|
53
|
+
const accept2shipTitle = (_b = (_a = pullRequest.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(hashTag);
|
|
54
|
+
(0, core_1.info)(`${hashTag} ${accept2shipTitle ? "" : "not "}found in title`);
|
|
55
|
+
const accept2shipBody = (_d = (_c = pullRequest.body) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === null || _d === void 0 ? void 0 : _d.includes(hashTag);
|
|
56
|
+
(0, core_1.info)(`${hashTag} ${accept2shipBody ? "" : "not "}found in body`);
|
|
57
|
+
const accept2shipLabel = pullRequest.labels.some((label) => label.name.toLowerCase() === hashTagLabel);
|
|
58
|
+
(0, core_1.info)(`${hashTag} ${accept2shipLabel ? "" : "not "}found in labels`);
|
|
59
|
+
const pullRequestUserId = pullRequest.user.id;
|
|
60
|
+
const comments = yield (0, getPullRequestComments_1.getPullRequestComments)(owner, repo, pullRequestNumber, octokit);
|
|
61
|
+
const accept2shipComment = comments.some((comment) => {
|
|
62
|
+
var _a;
|
|
63
|
+
return ((_a = comment.user) === null || _a === void 0 ? void 0 : _a.id) === pullRequestUserId &&
|
|
64
|
+
comment.body.toLowerCase().includes(hashTag);
|
|
65
|
+
});
|
|
66
|
+
(0, core_1.info)(`${hashTag} ${accept2shipComment ? "" : "not "}found in comments`);
|
|
67
|
+
const accept2shipTag = accept2shipTitle ||
|
|
68
|
+
accept2shipBody ||
|
|
69
|
+
accept2shipLabel ||
|
|
70
|
+
accept2shipComment;
|
|
71
|
+
if (!accept2shipTag) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const reviewRequests = yield (0, getPullRequestReviewRequests_1.getPullRequestReviewRequests)(owner, repo, pullRequestNumber, octokit);
|
|
75
|
+
if (reviewRequests.users.length > 0) {
|
|
76
|
+
(0, core_1.info)(`Review requested from users: ${reviewRequests.users
|
|
77
|
+
.map((user) => `${user.login} (${user.html_url})`)
|
|
78
|
+
.join()}`);
|
|
79
|
+
}
|
|
80
|
+
if (reviewRequests.teams.length > 0) {
|
|
81
|
+
(0, core_1.info)(`Review requested from teams: ${reviewRequests.teams
|
|
82
|
+
.map((team) => team.name)
|
|
83
|
+
.join()}`);
|
|
84
|
+
}
|
|
85
|
+
if (reviewRequests.users.length === 0 && reviewRequests.teams.length === 0) {
|
|
86
|
+
(0, core_1.info)(`Review not requested.`);
|
|
87
|
+
}
|
|
88
|
+
const reviews = yield (0, getPullRequestReviews_1.getPullRequestReviews)(owner, repo, pullRequestNumber, octokit);
|
|
89
|
+
const acceptZeroApprovals = (0, core_1.getBooleanInput)("request-zero-accept-zero");
|
|
90
|
+
let approved = false;
|
|
91
|
+
const reviewsSortedByDescendingTime = reviews.sort((x, y) => { var _a, _b; return Date.parse((_a = y.submitted_at) !== null && _a !== void 0 ? _a : "") - Date.parse((_b = x.submitted_at) !== null && _b !== void 0 ? _b : ""); });
|
|
92
|
+
if (reviewRequests.users.length === 0 && reviewRequests.teams.length === 0) {
|
|
93
|
+
if (acceptZeroApprovals) {
|
|
94
|
+
approved = reviews.every((review) => review.state !== CHANGES_REQUESTED);
|
|
95
|
+
(0, core_1.info)(`Review states: ${reviews.length || "none"}`);
|
|
96
|
+
for (const review of reviews) {
|
|
97
|
+
(0, core_1.info)(` ${(_f = (_e = review.user) === null || _e === void 0 ? void 0 : _e.login) !== null && _f !== void 0 ? _f : "Unknown"}: ${review.state}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const lastReview = reviewsSortedByDescendingTime[0];
|
|
102
|
+
(0, core_1.info)(`Last review state: ${(_g = lastReview === null || lastReview === void 0 ? void 0 : lastReview.state) !== null && _g !== void 0 ? _g : "none"}`);
|
|
103
|
+
approved = (lastReview === null || lastReview === void 0 ? void 0 : lastReview.state) === APPROVED;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const reviewUserIds = reviewRequests.users.map((user) => user.id);
|
|
108
|
+
const lastReviewPerUserId = reviewsSortedByDescendingTime.reduce((result, review) => {
|
|
109
|
+
var _a;
|
|
110
|
+
const user = review.user;
|
|
111
|
+
if (user) {
|
|
112
|
+
result[user.id] = (_a = result[user.id]) !== null && _a !== void 0 ? _a : review;
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
}, {});
|
|
116
|
+
(0, core_1.info)(`Last review by user:`);
|
|
117
|
+
for (const user of reviewRequests.users) {
|
|
118
|
+
(0, core_1.info)(` ${user.login}: ${(_j = (_h = lastReviewPerUserId[user.id]) === null || _h === void 0 ? void 0 : _h.state) !== null && _j !== void 0 ? _j : "none"} ${user.id in lastReviewPerUserId
|
|
119
|
+
? `(${(_k = lastReviewPerUserId[user.id]) === null || _k === void 0 ? void 0 : _k.html_url})`
|
|
120
|
+
: ""}`);
|
|
121
|
+
}
|
|
122
|
+
approved = reviewUserIds
|
|
123
|
+
.map((userId) => lastReviewPerUserId[userId])
|
|
124
|
+
.every((review) => (review === null || review === void 0 ? void 0 : review.state) === APPROVED);
|
|
125
|
+
}
|
|
126
|
+
if (!approved) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
(0, core_1.endGroup)();
|
|
130
|
+
const jobs = yield (0, getWorkflowRunJobs_1.getWorkflowRunJobs)(owner, repo, octokit);
|
|
131
|
+
(0, core_1.info)(`Jobs in current Workflow: ${jobs.length}`);
|
|
132
|
+
for (const job of jobs) {
|
|
133
|
+
(0, core_1.info)(` Job id: ${job.id} (${job.html_url})`);
|
|
134
|
+
(0, core_1.info)(` Job name: ${job.name}`);
|
|
135
|
+
(0, core_1.info)(` Job run id/attempt: ${job.run_id}-${job.run_attempt}`);
|
|
136
|
+
if (job.steps !== undefined) {
|
|
137
|
+
(0, core_1.startGroup)(` Job steps: ${job.steps.length}`);
|
|
138
|
+
for (const step of job.steps) {
|
|
139
|
+
(0, core_1.info)(` Step number: ${step.number}`);
|
|
140
|
+
(0, core_1.info)(` Step name: ${step.name}`);
|
|
141
|
+
(0, core_1.info)(` Step status/conclusion: ${step.status === COMPLETED ? step.conclusion : step.status}\n`);
|
|
142
|
+
}
|
|
143
|
+
(0, core_1.endGroup)();
|
|
144
|
+
(0, core_1.info)("\n\n");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const jobIds = jobs.map((job) => job.id);
|
|
148
|
+
const timeout = parseInt((0, core_1.getInput)("timeout"), 10);
|
|
149
|
+
const interval = parseInt((0, core_1.getInput)("checks-watch-interval"), 10);
|
|
150
|
+
const failIfTimeout = (0, core_1.getBooleanInput)("fail-if-timeout");
|
|
151
|
+
let worthChecking = true;
|
|
152
|
+
let externalIds = undefined;
|
|
153
|
+
while (worthChecking) {
|
|
154
|
+
const checkRuns = yield (0, getCheckRuns_1.getCheckRuns)(owner, repo, pullRequest.head.sha, octokit);
|
|
155
|
+
(0, core_1.info)(`Checks:`);
|
|
156
|
+
for (const checkRun of checkRuns) {
|
|
157
|
+
(0, core_1.info)(` Check id: ${checkRun.id} (${checkRun.html_url})`);
|
|
158
|
+
(0, core_1.info)(` Check name: ${checkRun.name}`);
|
|
159
|
+
if (checkRun.status === COMPLETED) {
|
|
160
|
+
if (checkRun.conclusion !== null &&
|
|
161
|
+
[SUCCESS, NEUTRAL, SKIPPED].includes(checkRun.conclusion)) {
|
|
162
|
+
(0, core_1.info)(` Check status/conclusion: ${checkRun.conclusion}\n\n`);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
(0, core_1.error)(` Check status/conclusion: ${checkRun.conclusion}\n\n`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
(0, core_1.warning)(` Check status/conclusion: ${checkRun.status}\n\n`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (externalIds === undefined) {
|
|
173
|
+
// Two instances of the same job's execution share the same external id but not the same job id.
|
|
174
|
+
// We use external id to identify other instances of the job.
|
|
175
|
+
externalIds = checkRuns
|
|
176
|
+
.filter((checkRun) => jobIds.includes(checkRun.id) && checkRun.external_id !== null)
|
|
177
|
+
.map((checkRun) => checkRun.external_id);
|
|
178
|
+
}
|
|
179
|
+
const failedChecks = checkRuns.filter((checkRun) => !jobIds.includes(checkRun.id) &&
|
|
180
|
+
!(externalIds === null || externalIds === void 0 ? void 0 : externalIds.includes(checkRun.external_id)) &&
|
|
181
|
+
checkRun.status === COMPLETED &&
|
|
182
|
+
(checkRun.conclusion === null ||
|
|
183
|
+
![SUCCESS, NEUTRAL, SKIPPED].includes(checkRun.conclusion)));
|
|
184
|
+
if (failedChecks.length > 0) {
|
|
185
|
+
(0, core_1.info)(`Failed checks: ${failedChecks.length}`);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const incompleteChecks = checkRuns.filter((checkRun) => !jobIds.includes(checkRun.id) &&
|
|
189
|
+
!(externalIds === null || externalIds === void 0 ? void 0 : externalIds.includes(checkRun.external_id)) &&
|
|
190
|
+
checkRun.status !== COMPLETED);
|
|
191
|
+
if (incompleteChecks.length > 0) {
|
|
192
|
+
(0, core_1.info)(`Incomplete checks: ${incompleteChecks.length}`);
|
|
193
|
+
const executionTime = Math.round(node_perf_hooks_1.performance.now() / 1000);
|
|
194
|
+
(0, core_1.info)(`Execution time: ${FORMATTER.format(executionTime)}`);
|
|
195
|
+
if (executionTime > timeout) {
|
|
196
|
+
if (failIfTimeout) {
|
|
197
|
+
(0, core_1.setFailed)(`Timeout: ${FORMATTER.format(executionTime)} > ${FORMATTER.format(timeout)}`);
|
|
198
|
+
}
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
(0, core_1.info)(`Sleeping: ${FORMATTER.format(interval)}\n`);
|
|
202
|
+
yield (0, sleep_1.sleep)(interval * 1000);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
worthChecking = false;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const mergedAfterValidations = yield (0, mergePullRequest_1.checkIfPullRequestMerged)(owner, repo, pullRequestNumber, octokit);
|
|
209
|
+
if (mergedAfterValidations) {
|
|
210
|
+
(0, core_1.error)(`This Pull Request has been merged already.`);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const mergeMethod = (0, getMergeMethod_1.getMergeMethod)();
|
|
214
|
+
(0, core_1.info)(`Merging with merge method: ${mergeMethod}`);
|
|
215
|
+
yield (0, mergePullRequest_1.mergePullRequest)(owner, repo, pullRequestNumber, mergeMethod, octokit);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function run() {
|
|
219
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
(0, core_1.info)(`Event name: ${github_1.context.eventName}`);
|
|
221
|
+
switch (github_1.context.eventName) {
|
|
222
|
+
case "pull_request":
|
|
223
|
+
yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
const pullRequest = github_1.context.payload.pull_request;
|
|
225
|
+
yield handlePullRequest(pullRequest.number);
|
|
226
|
+
}))();
|
|
227
|
+
break;
|
|
228
|
+
case "pull_request_review":
|
|
229
|
+
yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
const pullRequest = github_1.context.payload
|
|
231
|
+
.pull_request;
|
|
232
|
+
yield handlePullRequest(pullRequest.number);
|
|
233
|
+
}))();
|
|
234
|
+
break;
|
|
235
|
+
case "check_run":
|
|
236
|
+
yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
237
|
+
const checkRun = github_1.context.payload.check_run;
|
|
238
|
+
if (checkRun.status !== COMPLETED ||
|
|
239
|
+
checkRun.conclusion === null ||
|
|
240
|
+
![SUCCESS, NEUTRAL, SKIPPED].includes(checkRun.conclusion)) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
yield Promise.all(checkRun.pull_requests.map((pullRequest) => handlePullRequest(pullRequest.number)));
|
|
244
|
+
}))();
|
|
245
|
+
return;
|
|
246
|
+
case "check_suite":
|
|
247
|
+
yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
248
|
+
const checkSuites = github_1.context.payload.check_suite;
|
|
249
|
+
if (checkSuites.status !== COMPLETED ||
|
|
250
|
+
checkSuites.conclusion === null ||
|
|
251
|
+
![SUCCESS, NEUTRAL, SKIPPED].includes(checkSuites.conclusion)) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
yield Promise.all(checkSuites.pull_requests.map((pullRequest) => handlePullRequest(pullRequest.number)));
|
|
255
|
+
}))();
|
|
256
|
+
return;
|
|
257
|
+
case "workflow_run":
|
|
258
|
+
yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
259
|
+
const workflowRun = github_1.context.payload.workflow_run;
|
|
260
|
+
if (workflowRun.status !== COMPLETED ||
|
|
261
|
+
workflowRun.conclusion === null ||
|
|
262
|
+
![SUCCESS, NEUTRAL, SKIPPED].includes(workflowRun.conclusion)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
switch (workflowRun.event) {
|
|
266
|
+
case "pull_request":
|
|
267
|
+
case "push":
|
|
268
|
+
yield Promise.all(workflowRun.pull_requests.map((pullRequest) => handlePullRequest(pullRequest.number)));
|
|
269
|
+
return;
|
|
270
|
+
default:
|
|
271
|
+
(0, core_1.error)(`Unimplemented GitHub Action event: ${github_1.context.eventName}/${workflowRun.event}`);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
}))();
|
|
275
|
+
break;
|
|
276
|
+
case "workflow_dispatch":
|
|
277
|
+
default:
|
|
278
|
+
(0, core_1.error)(`Unsupported GitHub Action event: ${github_1.context.eventName}`);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
run();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Octokit } from "@octokit/core";
|
|
2
|
+
import { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
|
|
3
|
+
import { getMergeMethod } from "./getMergeMethod";
|
|
4
|
+
export declare function checkIfPullRequestMerged(owner: string, repo: string, pullRequestNumber: number, octokit: Octokit & Api): Promise<boolean>;
|
|
5
|
+
export declare function mergePullRequest(owner: string, repo: string, pullRequestNumber: number, mergeMethod: ReturnType<typeof getMergeMethod>, octokit: Octokit & Api): Promise<void>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.mergePullRequest = exports.checkIfPullRequestMerged = void 0;
|
|
13
|
+
const request_error_1 = require("@octokit/request-error");
|
|
14
|
+
function checkIfPullRequestMerged(owner, repo, pullRequestNumber, octokit) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
let response;
|
|
17
|
+
try {
|
|
18
|
+
response = yield octokit.rest.pulls.checkIfMerged({
|
|
19
|
+
owner,
|
|
20
|
+
repo,
|
|
21
|
+
pull_number: pullRequestNumber,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
if (error instanceof request_error_1.RequestError) {
|
|
26
|
+
response = error.response;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === 204) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
else if ((response === null || response === void 0 ? void 0 : response.status) === 404) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
throw new Error(`Failed to check if pull request is merged: ${response === null || response === void 0 ? void 0 : response.status}`);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.checkIfPullRequestMerged = checkIfPullRequestMerged;
|
|
41
|
+
function mergePullRequest(owner, repo, pullRequestNumber, mergeMethod, octokit) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const response = yield octokit.rest.pulls.merge({
|
|
44
|
+
owner,
|
|
45
|
+
repo,
|
|
46
|
+
pull_number: pullRequestNumber,
|
|
47
|
+
merge_method: mergeMethod,
|
|
48
|
+
});
|
|
49
|
+
if (response.status !== 200) {
|
|
50
|
+
throw new Error(`Failed to merge pull request: ${response.status}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
exports.mergePullRequest = mergePullRequest;
|
package/lib/sleep.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleep(ms: number | undefined): Promise<unknown>;
|
package/lib/sleep.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.sleep = void 0;
|
|
13
|
+
function sleep(ms) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
setTimeout(resolve, ms);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.sleep = sleep;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Octokit } from "@octokit/core";
|
|
2
|
+
import { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
|
|
3
|
+
import { components } from "@octokit/openapi-types/types";
|
|
4
|
+
export declare function updateCheckRun(owner: string, repo: string, runId: number, conclusion: components["schemas"]["check-run"]["conclusion"], octokit: Octokit & Api): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.updateCheckRun = void 0;
|
|
13
|
+
function updateCheckRun(owner, repo, runId, conclusion, octokit) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
yield octokit.rest.checks.update({
|
|
16
|
+
owner,
|
|
17
|
+
repo,
|
|
18
|
+
check_run_id: runId,
|
|
19
|
+
conclusion,
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.updateCheckRun = updateCheckRun;
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "accept-to-ship-action",
|
|
3
|
+
"version": "0.3.3",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "yarn tsc",
|
|
10
|
+
"package": "yarn ncc build src/index.ts --external eslint --source-map --license licenses.txt",
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
|
+
"lint": "eslint -c .eslintrc.json src",
|
|
13
|
+
"preversion": "rm -rf lib && rm -rf dist && yarn && yarn build && yarn package"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/CatChen/accept-to-ship-action.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "Cat Chen",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/CatChen/accept-to-ship-action/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/CatChen/accept-to-ship-action#readme",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^18.11.3",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
|
28
|
+
"@typescript-eslint/parser": "^5.40.1",
|
|
29
|
+
"@vercel/ncc": "^0.34.0",
|
|
30
|
+
"eslint": "^8.25.0",
|
|
31
|
+
"eslint-config-prettier": "^8.5.0",
|
|
32
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
33
|
+
"husky": "^8.0.1",
|
|
34
|
+
"prettier": "^2.7.1",
|
|
35
|
+
"pretty-quick": "^3.1.3",
|
|
36
|
+
"typescript": "^4.8.4"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@actions/core": "^1.10.0",
|
|
40
|
+
"@actions/github": "^5.1.1",
|
|
41
|
+
"@octokit/plugin-retry": "^3.0.9",
|
|
42
|
+
"@octokit/plugin-throttling": "^4.3.1",
|
|
43
|
+
"@octokit/webhooks-definitions": "^3.67.3"
|
|
44
|
+
}
|
|
45
|
+
}
|