File tree Expand file tree Collapse file tree 2 files changed +19
-23
lines changed Expand file tree Collapse file tree 2 files changed +19
-23
lines changed Original file line number Diff line number Diff line change @@ -22,19 +22,16 @@ const comment_1 = require("./comment");
22
22
function run ( ) {
23
23
var _a , _b , _c ;
24
24
return __awaiter ( this , void 0 , void 0 , function * ( ) {
25
+ const number = ( ( _c = ( _b = ( _a = github_1 . context ) === null || _a === void 0 ? void 0 : _a . payload ) === null || _b === void 0 ? void 0 : _b . pull_request ) === null || _c === void 0 ? void 0 : _c . number ) ||
26
+ + core . getInput ( "number" , { required : false } ) ;
27
+ if ( isNaN ( number ) || number < 1 ) {
28
+ core . info ( "no numbers given: skip step" ) ;
29
+ return ;
30
+ }
25
31
try {
26
32
const repo = github_1 . context . repo ;
27
- const number = ( ( _c = ( _b = ( _a = github_1 . context ) === null || _a === void 0 ? void 0 : _a . payload ) === null || _b === void 0 ? void 0 : _b . pull_request ) === null || _c === void 0 ? void 0 : _c . number ) || + core . getInput ( "number" ) ;
28
- const body = core . getInput ( "message" ) ;
29
- const githubToken = core . getInput ( "GITHUB_TOKEN" ) ;
30
- if ( isNaN ( number ) ) {
31
- core . setFailed ( "not found pull request number" ) ;
32
- return ;
33
- }
34
- if ( ! body || ! githubToken ) {
35
- core . setFailed ( "invalid input: please check your workflow" ) ;
36
- return ;
37
- }
33
+ const body = core . getInput ( "message" , { required : true } ) ;
34
+ const githubToken = core . getInput ( "GITHUB_TOKEN" , { required : true } ) ;
38
35
const octokit = new github_1 . GitHub ( githubToken ) ;
39
36
const previous = yield comment_1 . findPreviousComment ( octokit , repo , number ) ;
40
37
if ( previous ) {
Original file line number Diff line number Diff line change 1
1
import * as core from "@actions/core" ;
2
2
import { context , GitHub } from "@actions/github" ;
3
3
import { findPreviousComment , createComment , updateComment } from "./comment" ;
4
+
4
5
async function run ( ) {
6
+ const number =
7
+ context ?. payload ?. pull_request ?. number ||
8
+ + core . getInput ( "number" , { required : false } ) ;
9
+ if ( isNaN ( number ) || number < 1 ) {
10
+ core . info ( "no numbers given: skip step" ) ;
11
+ return ;
12
+ }
13
+
5
14
try {
6
15
const repo = context . repo ;
7
- const number =
8
- context ?. payload ?. pull_request ?. number || + core . getInput ( "number" ) ;
9
- const body = core . getInput ( "message" ) ;
10
- const githubToken = core . getInput ( "GITHUB_TOKEN" ) ;
11
- if ( isNaN ( number ) ) {
12
- core . setFailed ( "not found pull request number" ) ;
13
- return ;
14
- }
15
- if ( ! body || ! githubToken ) {
16
- core . setFailed ( "invalid input: please check your workflow" ) ;
17
- return ;
18
- }
16
+ const body = core . getInput ( "message" , { required : true } ) ;
17
+ const githubToken = core . getInput ( "GITHUB_TOKEN" , { required : true } ) ;
19
18
const octokit = new GitHub ( githubToken ) ;
20
19
const previous = await findPreviousComment ( octokit , repo , number ) ;
21
20
if ( previous ) {
You can’t perform that action at this time.
0 commit comments