You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: "Enable overwriting existing files, defaults to \"false\"",
116
116
Default: false,
117
117
},
118
+
"autocreate_branch": {
119
+
Type: schema.TypeBool,
120
+
Optional: true,
121
+
Description: "Automatically create the branch if it could not be found. Subsequent reads if the branch is deleted will occur from 'autocreate_branch_source_branch'",
122
+
Default: false,
123
+
},
124
+
"autocreate_branch_source_branch": {
125
+
Type: schema.TypeString,
126
+
Default: "main",
127
+
Optional: true,
128
+
Description: "The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.",
129
+
},
130
+
"autocreate_branch_source_sha": {
131
+
Type: schema.TypeString,
132
+
Optional: true,
133
+
Computed: true,
134
+
Description: "The commit hash to start from, if 'autocreate_branch' is set. Defaults to the tip of 'autocreate_branch_source_branch'. If provided, 'autocreate_branch_source_branch' is ignored.",
135
+
},
118
136
},
119
137
}
120
138
}
@@ -173,7 +191,29 @@ func resourceGithubRepositoryFileCreate(d *schema.ResourceData, meta interface{}
173
191
ifbranch, ok:=d.GetOk("branch"); ok {
174
192
log.Printf("[DEBUG] Using explicitly set branch: %s", branch.(string))
@@ -45,7 +68,7 @@ The following arguments are supported:
45
68
*`content` - (Required) The file content.
46
69
47
70
*`branch` - (Optional) Git branch (defaults to the repository's default branch).
48
-
The branch must already exist, it will not be created if it does not already exist.
71
+
The branch must already exist, it will only be created automatically if 'autocreate_branch' is set true.
49
72
50
73
*`commit_author` - (Optional) Committer author name to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This maybe useful when a branch protection rule requires signed commits.
51
74
@@ -55,6 +78,12 @@ The following arguments are supported:
*`autocreate_branch` - (Optional) Automatically create the branch if it could not be found. Defaults to false. Subsequent reads if the branch is deleted will occur from 'autocreate_branch_source_branch'.
82
+
83
+
*`autocreate_branch_source_branch` - (Optional) The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
84
+
85
+
*`autocreate_branch_source_sha` - (Optional) The commit hash to start from, if 'autocreate_branch' is set. Defaults to the tip of 'autocreate_branch_source_branch'. If provided, 'autocreate_branch_source_branch' is ignored.
0 commit comments