Title: | Easy GitHub Actions workflows for small-scale data-retrieving processes |
---|---|
Description: | Helps to create GitHub Actions workflows for small-scale data-retrieving processes such as scraping a website. Sets up the YAML file, creates the necessary directory structure and sets Actions Secrets on GitHub if needed. |
Authors: | Felix Lorenz [aut, cre], Felix Luginbuhl [ctb] |
Maintainer: | Felix Lorenz <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.2 |
Built: | 2024-11-22 05:22:23 UTC |
Source: | https://github.com/ogdtg/ghactionsOGD |
This function sets up a GitHub Action workflow using a cron job by doing the following steps:
Creates the necessary directory structure.
Creates the YAML file to configure the workflow.
Sets Actions Secrets if needed.
create_ghactions_workflow( cron = NULL, name, container_name = "rocker/tidyverse:4.1.2", env = NULL, scripts, repo = get_repo_name(), commit_message = "Automated changes by GitHub Actions", token = get_git_pwd() )
create_ghactions_workflow( cron = NULL, name, container_name = "rocker/tidyverse:4.1.2", env = NULL, scripts, repo = get_repo_name(), commit_message = "Automated changes by GitHub Actions", token = get_git_pwd() )
cron |
A string specifying the schedule in cron notation (e.g., "0 0 * * *" for daily at midnight). |
name |
Name of the workflow |
container_name |
Name of the container. This can be any docker container publicly available. Default is rocker/tidyverse:4.1.2 |
env |
Named list of environmental Variables such as keys that are used in the script(s). All given variables will be set as Actions secrets on GitHub. |
scripts |
A vector of the paths of R scripts that should be executed in the workflow |
repo |
Name of the repo. By default the function retreives the name of the current repo by using |
commit_message |
Commit Message for automatic commits |
token |
Personal Access Token with the necessary permissions to set Actions Secrets. By default the function retreives the password from the git.config by using |
IMPORTANT: The directory where the workflow should be created has to be a git repository!
list with the full workflow
## Not run: create_ghactions_workflow(cron = "31 2 * * *", name = "Test", env = list(ODS_KEY = Sys.getenv("ODS_KEY")), scripts = "test.R") ## End(Not run)
## Not run: create_ghactions_workflow(cron = "31 2 * * *", name = "Test", env = list(ODS_KEY = Sys.getenv("ODS_KEY")), scripts = "test.R") ## End(Not run)
Retrieve GitHub Password used in current repo
get_git_pwd()
get_git_pwd()
password
Retrieve GitHub owner and repo name
get_git_remote()
get_git_remote()
owner/repo
Retrieve GitHub User of current repo
get_git_user()
get_git_user()
username
Retrieve GitHub repo name
get_repo_name()
get_repo_name()
repo name
See use_ghactions()
use_ghactions_ogd(workflow)
use_ghactions_ogd(workflow)
workflow |