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\"",
120
120
Default: false,
121
121
},
122
+
"autocreate_branch": {
123
+
Type: schema.TypeBool,
124
+
Optional: true,
125
+
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'",
126
+
Default: false,
127
+
},
128
+
"autocreate_branch_source_branch": {
129
+
Type: schema.TypeString,
130
+
Default: "main",
131
+
Optional: true,
132
+
Description: "The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.",
133
+
RequiredWith: []string{"autocreate_branch"},
134
+
},
135
+
"autocreate_branch_source_sha": {
136
+
Type: schema.TypeString,
137
+
Optional: true,
138
+
Computed: true,
139
+
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.",
140
+
RequiredWith: []string{"autocreate_branch"},
141
+
},
122
142
},
123
143
}
124
144
}
@@ -177,7 +197,29 @@ func resourceGithubRepositoryFileCreate(d *schema.ResourceData, meta interface{}
177
197
ifbranch, ok:=d.GetOk("branch"); ok {
178
198
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:
55
78
56
79
*`overwrite_on_create` - (Optional) Enable overwriting existing files. If set to `true` it will overwrite an existing file with the same name. If set to `false` it will fail if there is an existing file with the same name.
57
80
81
+
*`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