fix fatal error when the envvar CI_COMMIT_PULL_REQUEST is empty
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

add test before parse the value as integer
This commit is contained in:
Simon Vieille 2023-07-10 10:01:22 +02:00
parent 4bee788ffe
commit 2a95770f61
Signed by: deblan
GPG key ID: 579388D585F70417

11
main.go
View file

@ -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()
}