Package 'GithubActions'

Title: Functions to facilitate use of Github Actions via R
Description: Work in progress. Not yet working well.
Authors: Sebastian Kranz
Maintainer: Sebastian Kranz <[email protected]>
License: GPL >= 2.0
Version: 0.1.0
Built: 2024-10-29 04:31:07 UTC
Source: https://github.com/repboxr/GithubActions

Help Index


Show authentication status

Description

Show authentication status

Usage

gh_auth_status()

Clone a repository on Github to a local directory

Description

Clone a repository on Github to a local directory

Usage

gh_clone(repo, repodir)

Download an artifact generated by a finished job

Description

Download an artifact generated by a finished job

Usage

gh_download_artifact(
  repo,
  destfile,
  artifact_id = NULL,
  runid = NULL,
  pat = gh_pat()
)

Info about a workflow run.

Description

Info about a workflow run.

Usage

gh_info_run(repo, runid, pat = gh_pat())

List all artifacts of a repo List all artifacts of a repo or single run

Description

List all artifacts of a repo List all artifacts of a repo or single run

Usage

gh_list_artifacts(repo, runid = NULL, pat = gh_pat())

Show all jobs of a run. Some functions require the corresponding job id.

Description

Show all jobs of a run. Some functions require the corresponding job id.

Usage

gh_list_run_jobs(repo, runid, pat = gh_pat())

Return all workflow runs

Description

Return all workflow runs

Usage

gh_list_runs(repo, pat = gh_pat())

Return all workflows of the specified repo

Description

Return all workflows of the specified repo

Usage

gh_list_workflows(repo, pat = gh_pat())

Login to github with your email and username

Description

Login to github with your email and username

Usage

gh_login(email, username)

Create a new repo on github and locally

Description

Create a new repo on github and locally

Usage

gh_new_repo(
  reponame,
  parentdir,
  access = c("public", "private")[2],
  pat = gh_pat()
)

Get the id if the newest workflow run of a repo.

Description

Get the id if the newest workflow run of a repo.

Usage

gh_newest_runid(repo, pat = gh_pat())

Get personal access token that was previously set b gh_set_pat.

Description

Get personal access token that was previously set b gh_set_pat.

Usage

gh_pat()

Remove a branch from local and github repository

Description

Remove a branch from local and github repository

Usage

gh_remove_branch(repodir, branch)

Removes all old commits of a branch and only keeps current local files

Description

Based on https://superuser.com/questions/926915/how-can-i-delete-old-commits-in-github-via-terminal WARNING: Don't use for real code repos, in particular not for repos multiple users work with.

Usage

gh_remove_history(repodir, branch = "main")

Remove a secret from the repository

Description

Remove a secret from the repository

Usage

gh_remove_secret(repodir, name)

Get log of a particular workflow run

Description

Get log of a particular workflow run

Usage

gh_run_log(repodir, runid)

Trigger the specified workflow

Description

Only works if the workflow YAML file sets

Usage

gh_run_workflow(
  repo,
  name = NULL,
  branch = "main",
  inputs = NULL,
  pat = gh_pat()
)

Arguments

repo

The repository name in format user/reponame.

name

The name of the workflow. If NULL use the first workflow

branch

The Github branch. By default "main"

inputs

Not yet tested. Potential input parameters passed to the workflow.

Details

on: workflow_dispatch:


Set personal access token by writing it into environment variables.

Description

Set personal access token by writing it into environment variables.

Usage

gh_set_pat(pat)

Arguments

pat

A string containing the personal access token generated on Github.

Not very secure. At some point I should use the approach of the gh package


Set a repository secret using github client

Description

Set a repository secret using github client

Usage

gh_set_secret(repodir, name, value)

Arguments

repodir

path to your local repository

name

name of the secret

value

of the secret


Updates the Github repository to the new content of the local repo directory

Description

Updates the Github repository to the new content of the local repo directory

Usage

gh_update(repodir, msg = "update", remote = "origin", branch = "main")

Wait until a new Github action job has started

Description

Wait until a new Github action job has started

Usage

gh_wait_until_new_run_starts(
  repo,
  old_runid,
  pause.sec = 1,
  timeout = 60,
  pat = gh_pat()
)

Wait until a new Github action job is completed

Description

Wait until a new Github action job is completed

Usage

gh_wait_until_run_completed(
  repo,
  runid,
  pause.sec = 1,
  timeout = 60 * 60 * 10,
  pat = gh_pat()
)