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");
2222function run ( ) {
2323 var _a , _b , _c ;
2424 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+ }
2531 try {
2632 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 } ) ;
3835 const octokit = new github_1 . GitHub ( githubToken ) ;
3936 const previous = yield comment_1 . findPreviousComment ( octokit , repo , number ) ;
4037 if ( previous ) {
Original file line number Diff line number Diff line change 11import * as core from "@actions/core" ;
22import { context , GitHub } from "@actions/github" ;
33import { findPreviousComment , createComment , updateComment } from "./comment" ;
4+
45async 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+
514 try {
615 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 } ) ;
1918 const octokit = new GitHub ( githubToken ) ;
2019 const previous = await findPreviousComment ( octokit , repo , number ) ;
2120 if ( previous ) {
You can’t perform that action at this time.
0 commit comments