Skip to content

Commit 8198bea

Browse files
committed
rework: Use github_owner_type
Make it clearer that this is for GitHub only
1 parent 1909342 commit 8198bea

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

R/init_project_with_all.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ init_project_with_all <- function(project_name, project_gitlab_id = NULL, config
6666
ifelse(
6767
forge == "gitlab",
6868
paste("namespace: ", namespace_type),
69-
paste("GitHub Owner (", config$owner_type, "): ", config$github_owner)
69+
paste("GitHub Owner (", config$github_owner_type, "): ", config$github_owner)
7070
),
7171
paste("project_name: ", project_name),
7272
paste("project_type: ", config$project_type)
@@ -312,25 +312,25 @@ init_project_with_all <- function(project_name, project_gitlab_id = NULL, config
312312
# fetch user/orga node id
313313
req_user_node_id <- glue(
314314
'query{
315-
$_owner_type_$(login: "$_organization_$"){
315+
$_github_owner_type_$(login: "$_organization_$"){
316316
id
317317
}
318318
}',
319319
.open = "$_",
320320
.close = "_$",
321-
owner_type = config$owner_type,
321+
github_owner_type = config$github_owner_type,
322322
organization = config$github_owner,
323323
)
324324

325325
user_node_id <- gh_gql(
326326
query = req_user_node_id,
327327
.token = Sys.getenv(config$github_envt_token_name)
328328
) %>%
329-
pluck("data", config$owner_type, "id")
329+
pluck("data", config$github_owner_type, "id")
330330

331331
# emit warning if node id is not found
332332
if (is.null(user_node_id)) {
333-
cli_alert_warning("Failed to fetch {config$github_owner} as a GitHub {config$owner_type}")
333+
cli_alert_warning("Failed to fetch {config$github_owner} as a GitHub {config$github_owner_type}")
334334
}
335335

336336
# create board

dev/flat_init_project_with_all.Rmd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ gitlab_envt_token_name: GITLAB_PAT # Name of the environment variable to use
2323
gitlab_namespace_id: NULL # Group id where to create the GitLab projet
2424
github_url: https://github.com/
2525
github_owner: NULL
26-
owner_type: user # user or organization
26+
github_owner_type: user # user or organization
2727
github_envt_token_name: GITHUB_PAT
2828
default_branch: main
2929
project_type: package # or book, golem
@@ -77,7 +77,7 @@ thinkr_config_package_github <- here::here("inst", "thinkr_config_test_amend_git
7777
cat('forge: github
7878
github_url: https://github.com/
7979
github_owner: ThinkR-open
80-
owner_type: organization
80+
github_owner_type: organization
8181
github_envt_token_name: GITHUB_PAT
8282
project_type: package
8383
name_licence: ThinkR
@@ -174,7 +174,7 @@ init_project_with_all <- function(project_name, project_gitlab_id = NULL, config
174174
ifelse(
175175
forge == "gitlab",
176176
paste("namespace: ", namespace_type),
177-
paste("GitHub Owner (", config$owner_type, "): ", config$github_owner)
177+
paste("GitHub Owner (", config$github_owner_type, "): ", config$github_owner)
178178
),
179179
paste("project_name: ", project_name),
180180
paste("project_type: ", config$project_type)
@@ -420,25 +420,25 @@ init_project_with_all <- function(project_name, project_gitlab_id = NULL, config
420420
# fetch user/orga node id
421421
req_user_node_id <- glue(
422422
'query{
423-
$_owner_type_$(login: "$_organization_$"){
423+
$_github_owner_type_$(login: "$_organization_$"){
424424
id
425425
}
426426
}',
427427
.open = "$_",
428428
.close = "_$",
429-
owner_type = config$owner_type,
429+
github_owner_type = config$github_owner_type,
430430
organization = config$github_owner,
431431
)
432432
433433
user_node_id <- gh_gql(
434434
query = req_user_node_id,
435435
.token = Sys.getenv(config$github_envt_token_name)
436436
) %>%
437-
pluck("data", config$owner_type, "id")
437+
pluck("data", config$github_owner_type, "id")
438438
439439
# emit warning if node id is not found
440440
if (is.null(user_node_id)) {
441-
cli_alert_warning("Failed to fetch {config$github_owner} as a GitHub {config$owner_type}")
441+
cli_alert_warning("Failed to fetch {config$github_owner} as a GitHub {config$github_owner_type}")
442442
}
443443
444444
# create board

inst/config_default_thinkr_gitlab.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ gitlab_envt_token_name: GITLAB_PAT # Name of the environment variable to use
44
gitlab_namespace_id: NULL # Group id where to create the GitLab projet
55
github_url: https://github.com/
66
github_owner: NULL
7-
owner_type: user # user or organization
7+
github_owner_type: user # user or organization
88
github_envt_token_name: GITHUB_PAT
99
default_branch: main
1010
project_type: package # or book, golem

inst/thinkr_config_test_amend_github.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
forge: github
22
github_url: https://github.com/
33
github_owner: ThinkR-open
4-
owner_type: organization
4+
github_owner_type: organization
55
github_envt_token_name: GITHUB_PAT
66
project_type: package
77
name_licence: ThinkR

0 commit comments

Comments
 (0)