Skip to content

Commit 8a719b6

Browse files
author
Sébastien HOUZÉ
authored
Merge pull request #14 from inextensodigital/fix-deployment-status-environment
don't update deployment status environment when empty
2 parents 5191a21 + 337c746 commit 8a719b6

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
env:
6565
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6666
run: |
67-
id=$(github deployment create --autoMerge=false --productionEnvironment=false --environment staging $GITHUB_REF)
67+
id=$(github deployment create --productionEnvironment=false --environment staging $GITHUB_REF)
6868
github deployment_status create $id in_progress
6969
echo "##[set-output name=deployment_id;]$id"
7070
- env:
@@ -111,7 +111,7 @@ jobs:
111111
env:
112112
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113113
run: |
114-
id=$(github deployment create --autoMerge=false $GITHUB_REF)
114+
id=$(github deployment create $GITHUB_REF)
115115
echo "##[set-output name=deployment_id;]$id"
116116
# #-----------------------------8<----------------------------------------
117117
# # here: some job(s) to add for example a deploy button/process

cmd/deployment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func init() {
121121

122122
deployment.AddCommand(deploymentCreateCmd)
123123
deploymentCreateCmd.PersistentFlags().StringP("task", "t", "deploy", "Specifies a task to execute (e.g., deploy or deploy:migrations).")
124-
deploymentCreateCmd.PersistentFlags().BoolP("autoMerge", "a", true, "Attempts to automatically merge the default branch into the requested ref, if it's behind the default branch.")
124+
deploymentCreateCmd.PersistentFlags().BoolP("autoMerge", "a", false, "Attempts to automatically merge the default branch into the requested ref, if it's behind the default branch.")
125125
deploymentCreateCmd.PersistentFlags().StringSliceP("requiredContexts", "c", []string{}, "The status contexts to verify against commit status checks. If you omit this parameter, GitHub verifies all unique contexts before creating a deployment. To bypass checking entirely, pass an empty array. Defaults to all unique contexts.")
126126
deploymentCreateCmd.PersistentFlags().StringP("payload", "p", "", "JSON payload with extra information about the deployment.")
127127
deploymentCreateCmd.PersistentFlags().StringP("environment", "e", "production", "Name for the target deployment environment (e.g., production, staging, qa).")

cmd/deployment_status.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ var deploymentStatusCreateCmd = &cobra.Command{
125125
if err != nil {
126126
log.Fatal(err)
127127
}
128+
if len(*deploymentStatusRequest.Environment) == 0 {
129+
deploymentStatusRequest.Environment = nil
130+
}
128131

129132
deploymentStatus, _, err := client.Repositories.CreateDeploymentStatus(ctx, owner, repository, deploymentID, &deploymentStatusRequest)
130133
if err != nil {

0 commit comments

Comments
 (0)