update_repository: Update a user or organization repository

Description Usage Arguments Details Value Examples

View source: R/repositories.R

Description

This function updates a repository for the authenticated user or organization in GitHub. It can be used to change whether the project is private or has issues, projects or a wiki, it can redefine the allowed behaviour when merging pull requests or add or update team permissions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
update_repository(
  repo,
  name,
  description,
  homepage,
  private,
  has_issues,
  has_projects,
  has_wiki,
  default_branch,
  allow_squash_merge,
  allow_merge_commit,
  allow_rebase_merge,
  delete_branch_on_merge,
  archived,
  team,
  permission = "pull",
  ...
)

Arguments

repo

(string) The repository specified in the format: owner/repo.

name

(string, optional) The name of the repository.

description

(string, optional) A short description of the repository.

homepage

(string, optional) A URL with more information about the repository.

private

(boolean, optional) Whether the repository is private or public.

has_issues

(boolean, optional) Whether to enable issues for the repository.

has_projects

(boolean, optional) Whether to enable projects for the repository.

has_wiki

(boolean, optional) Whether to enable the wiki for the repository.

default_branch

(string, optional) The name of the default branch.

allow_squash_merge

(boolean, optional) Whether to allow squash-merging pull requests.

allow_merge_commit

(boolean, optional) Whether to allow merging pull requests with a merge commit.

allow_rebase_merge

(boolean, optional) Whether to allow rebase-merging pull requests.

delete_branch_on_merge

(boolean, optional) Whether to allow automatically deleting branches when pull requests are merged.

archived

(boolean, optional) Whether to archive the repository.

team

(string) The team name.

permission

(string, optional) The permission to set for the team. Either: "pull"``, "push", "admin", "maintain"or"triage". Default: "pull"'.

...

Parameters passed to gh_request().

Details

The team's permission can be set to:

For more details see the GitHub API documentation:

Value

update_repository() returns a list of the repository properties.

Repository Properties:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
## Not run: 

  # Update a repository
  update_repository(
    repo           = "ChadGoymer/user-repository",
    name           = "updated-user-repository",
    description    = "This is an updated user repository",
    homepage       = "https://updated-user-repository.com",
    has_issues     = FALSE,
    has_projects   = FALSE,
    has_wiki       = FALSE,
    default_branch = "main"
  )

  # Update an organization's repository
  update_repository(
    repo                   = "HairyCoos/org-repository",
    name                   = "updated-org-repository",
    description            = "This is an updated organization repository",
    homepage               = "https://updated-org-repository.com",
    private                = FALSE,
    allow_squash_merge     = FALSE,
    allow_merge_commit     = FALSE,
    allow_rebase_merge     = TRUE,
    delete_branch_on_merge = TRUE
  )

  # Archive a repository
  update_repository("HairyCoos/org-repository", archived = TRUE)

  # Add read access for the specified team
  update_repository(
    repo = "HairyCoos/test-repository",
    team = "test-team"
  )

  # Update team's permission to "maintain"
  update_repository(
    repo       = "HairyCoos/test-repository",
    team       = "test-team",
    permission = "maintain"
  )


## End(Not run)

ChadGoymer/githapi documentation built on Oct. 22, 2021, 10:56 a.m.