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 |
Show authentication status
gh_auth_status()
gh_auth_status()
Clone a repository on Github to a local directory
gh_clone(repo, repodir)
gh_clone(repo, repodir)
Download an artifact generated by a finished job
gh_download_artifact( repo, destfile, artifact_id = NULL, runid = NULL, pat = gh_pat() )
gh_download_artifact( repo, destfile, artifact_id = NULL, runid = NULL, pat = gh_pat() )
Info about a workflow run.
gh_info_run(repo, runid, pat = gh_pat())
gh_info_run(repo, runid, pat = gh_pat())
List all artifacts of a repo List all artifacts of a repo or single run
gh_list_artifacts(repo, runid = NULL, pat = gh_pat())
gh_list_artifacts(repo, runid = NULL, pat = gh_pat())
Show all jobs of a run. Some functions require the corresponding job id.
gh_list_run_jobs(repo, runid, pat = gh_pat())
gh_list_run_jobs(repo, runid, pat = gh_pat())
Return all workflow runs
gh_list_runs(repo, pat = gh_pat())
gh_list_runs(repo, pat = gh_pat())
Return all workflows of the specified repo
gh_list_workflows(repo, pat = gh_pat())
gh_list_workflows(repo, pat = gh_pat())
Login to github with your email and username
gh_login(email, username)
gh_login(email, username)
Create a new repo on github and locally
gh_new_repo( reponame, parentdir, access = c("public", "private")[2], pat = gh_pat() )
gh_new_repo( reponame, parentdir, access = c("public", "private")[2], pat = gh_pat() )
Get the id if the newest workflow run of a repo.
gh_newest_runid(repo, pat = gh_pat())
gh_newest_runid(repo, pat = gh_pat())
Get personal access token that was previously set b gh_set_pat.
gh_pat()
gh_pat()
Remove a branch from local and github repository
gh_remove_branch(repodir, branch)
gh_remove_branch(repodir, branch)
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.
gh_remove_history(repodir, branch = "main")
gh_remove_history(repodir, branch = "main")
Remove a secret from the repository
gh_remove_secret(repodir, name)
gh_remove_secret(repodir, name)
Get log of a particular workflow run
gh_run_log(repodir, runid)
gh_run_log(repodir, runid)
Only works if the workflow YAML file sets
gh_run_workflow( repo, name = NULL, branch = "main", inputs = NULL, pat = gh_pat() )
gh_run_workflow( repo, name = NULL, branch = "main", inputs = NULL, pat = gh_pat() )
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. |
on: workflow_dispatch:
Set personal access token by writing it into environment variables.
gh_set_pat(pat)
gh_set_pat(pat)
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
gh_set_secret(repodir, name, value)
gh_set_secret(repodir, name, value)
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
gh_update(repodir, msg = "update", remote = "origin", branch = "main")
gh_update(repodir, msg = "update", remote = "origin", branch = "main")
Wait until a new Github action job has started
gh_wait_until_new_run_starts( repo, old_runid, pause.sec = 1, timeout = 60, pat = gh_pat() )
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
gh_wait_until_run_completed( repo, runid, pause.sec = 1, timeout = 60 * 60 * 10, pat = gh_pat() )
gh_wait_until_run_completed( repo, runid, pause.sec = 1, timeout = 60 * 60 * 10, pat = gh_pat() )