From 2a95770f610054bd6331639764c03d672142bcf3 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Mon, 10 Jul 2023 10:01:22 +0200 Subject: [PATCH] fix fatal error when the envvar CI_COMMIT_PULL_REQUEST is empty add test before parse the value as integer --- main.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 84cd1f2..7e2b75a 100644 --- a/main.go +++ b/main.go @@ -324,7 +324,7 @@ func main() { }, // PullRequest - cli.IntFlag{ + cli.StringFlag{ Name: "pullRequest", Usage: "pull request number", EnvVar: "CI_COMMIT_PULL_REQUEST", @@ -407,9 +407,8 @@ func run(c *cli.Context) error { Signed: c.Bool("yaml.signed"), Verified: c.Bool("yaml.verified"), }, - Tag: c.String("tag"), - PullRequest: c.Int("pullRequest"), - DeployTo: c.String("deployTo"), + Tag: c.String("tag"), + DeployTo: c.String("deployTo"), Config: Config{ FromAddress: fromAddress, FromName: c.String("from.name"), @@ -431,5 +430,9 @@ func run(c *cli.Context) error { }, } + if len(c.String("pullRequest")) > 0 { + plugin.PullRequest = c.Int("pullRequest") + } + return plugin.Exec() }