Package 'ghactionsOGD'

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

Help Index


Creates a GithubAction Workflow

Description

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.

Usage

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()
)

Arguments

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 get_repo_name()

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 get_git_pwd()

Details

IMPORTANT: The directory where the workflow should be created has to be a git repository!

Value

list with the full workflow

Examples

## 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

Description

Retrieve GitHub Password used in current repo

Usage

get_git_pwd()

Value

password


Retrieve GitHub owner and repo name

Description

Retrieve GitHub owner and repo name

Usage

get_git_remote()

Value

owner/repo


Retrieve GitHub User of current repo

Description

Retrieve GitHub User of current repo

Usage

get_git_user()

Value

username


Retrieve GitHub repo name

Description

Retrieve GitHub repo name

Usage

get_repo_name()

Value

repo name


Workflow automation with GitHub Actions (specialised)

Description

See use_ghactions()

Usage

use_ghactions_ogd(workflow)

Arguments

workflow

see ghactions::use_ghactions()