Skip to content

Commit af60dfe

Browse files
authored
Restore ability to get GHA config from local file (#1640)
Closes #1548
1 parent 82e904a commit af60dfe

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

R/github-actions.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,14 @@ use_github_action <- function(name,
139139
save_as <- path(".github", "workflows", save_as)
140140
create_directory(path_dir(proj_path(save_as)))
141141

142-
# `ignore = FALSE` because we took care of this at directory level, above
143-
new <- use_github_file(url, save_as = save_as, ignore = FALSE, open = open)
142+
if (grepl("^http", url)) {
143+
# `ignore = FALSE` because we took care of this at directory level, above
144+
new <- use_github_file(url, save_as = save_as, ignore = FALSE, open = open)
145+
} else {
146+
# local file case, https://github.com/r-lib/usethis/issues/1548
147+
contents <- read_utf8(url)
148+
new <- write_over(proj_path(save_as), contents)
149+
}
144150

145151
if (!is.null(readme)) {
146152
ui_todo("Learn more at <{readme}>.")

0 commit comments

Comments
 (0)