@@ -70,11 +70,14 @@ use_github <- function(organisation = NULL,
7070 return (invisible ())
7171 }
7272
73- pkg <- package_data()
73+ pkg <- project_data()
74+ repo_name <- pkg $ Project %|| % gsub(" \n " , " " , pkg $ Package )
75+ repo_desc <- pkg $ Title %|| % " "
76+
7477 todo(" Check title and description" )
7578 code_block(
76- paste0(" Title: " , pkg $ Title ),
77- paste0(" Description: " , pkg $ Description ),
79+ paste0(" Name: " , repo_name ),
80+ paste0(" Description: " , repo_desc ),
7881 copy = FALSE
7982 )
8083 if (yesno(" Are title and description ok?" )) {
@@ -85,37 +88,39 @@ use_github <- function(organisation = NULL,
8588
8689 if (is.null(organisation )) {
8790 create <- gh :: gh(" POST /user/repos" ,
88- name = pkg $ Package ,
89- description = gsub( " \n " , " " , pkg $ Title ) ,
91+ name = repo_name ,
92+ description = repo_desc ,
9093 private = private ,
9194 .api_url = host ,
9295 .token = auth_token
9396 )
9497 } else {
9598 create <- gh :: gh(" POST /orgs/:org/repos" ,
9699 org = organisation ,
97- name = pkg $ Package ,
98- description = gsub( " \n " , " " , pkg $ Title ) ,
100+ name = repo_name ,
101+ description = repo_desc ,
99102 private = private ,
100103 .api_url = host ,
101104 .token = auth_token
102105 )
103106 }
104107
105108 done(" Adding GitHub remote" )
106- r <- git2r :: repository()
109+ r <- git2r :: repository(proj_get() )
107110 protocol <- match.arg(protocol )
108111 origin_url <- switch (protocol ,
109112 https = create $ clone_url ,
110113 ssh = create $ ssh_url
111114 )
112115 git2r :: remote_add(r , " origin" , origin_url )
113116
114- done(" Adding GitHub links to DESCRIPTION" )
115- use_github_links(auth_token = auth_token , host = host )
116- if (git_uncommitted()) {
117- git2r :: add(r , " DESCRIPTION" )
118- git2r :: commit(r , " Add GitHub links to DESCRIPTION" )
117+ if (is_package()) {
118+ done(" Adding GitHub links to DESCRIPTION" )
119+ use_github_links(auth_token = auth_token , host = host )
120+ if (git_uncommitted()) {
121+ git2r :: add(r , " DESCRIPTION" )
122+ git2r :: commit(r , " Add GitHub links to DESCRIPTION" )
123+ }
119124 }
120125
121126 done(" Pushing to GitHub and setting remote tracking branch" )
0 commit comments