ghactions (version 0.4.1)

make_blocks: Create GitHub Actions syntax blocks

Description

Creates the syntax building blocks for GitHub actions: workflows and actions. For details on the syntax and arguments, see here.

Usage

make_workflow_block(IDENTIFIER, on = "push", resolves)

make_action_block(IDENTIFIER, needs = NULL, uses, runs = NULL, args = NULL, env = NULL, secrets = NULL)

Arguments

IDENTIFIER

[character(1)] giving the name of the action or workflow block.

Used:

  • as an informative label on GitHub.com,

  • in the needs fields of other action blocks to model the workflow graph,

  • in the resolves fields of other workflow blocks to model the workflow graph.

on

[character(1)] giving the GitHub Event on which to trigger the workflow. Must be one of ghactions_events. Defaults to "push", in which case the workflow is triggered on every push event.

resolves

[character()] giving the action(s) to invoke.

needs

[character()] giving the actions (by their IDENTIFIERs) that must complete successfully before this action will be invoked. Defaults to NULL for no upstream dependencies.

uses

[character(1)] giving the Docker image that will run the action.

runs

[character(1)] giving the command to run in the docker image. Overrides the Dockerfile ENTRYPOINT. Defaults to NULL for no commands (recommended).

args

[character()] giving the arguments to pass to the action. Arguments get appended to the last command in ENTRYPOINT. Defaults to NULL for no arguments.

env

[list(character(1)] giving the environment variables to set in the action's runtime environment. Defaults to NULL for no environment variables.

secrets

[character()] giving the names of the secret variables to set in the runtime enviornment, which the action can access as an environment variable. The values of secrets must be set in your repository's "Settings" tab. Do not store secrets in your repository. GitHub advises against using GitHub actions for production secrets during the public beta period. Defaults to NULL for no secrets.

Value

[character(1)]

Functions

  • make_workflow_block: Write GitHub Actions syntax for one workflow block.

  • make_action_block: Create GitHub Actions syntax for one action block.

See Also

Other syntax: ghactions_events

Other syntax: ghactions_events

Other syntax: ghactions_events

Examples

Run this code
# NOT RUN {
make_workflow_block(
  IDENTIFIER = "Run calculation",
  on = "push",
  resolves = "Simple Addition"
)

# many R projects will need this block to first build an image from a DOCKERFILE
make_action_block(
  IDENTIFIER = "Build Image",
  uses = "actions/docker/cli@c08a5fc9e0286844156fefff2c141072048141f6",
  # this is an external github action, referenced tightly by sha
  args = "build --tag=repo:latest ."
)

make_action_block(
  IDENTIFIER = "Simple Addition",
  uses = "maxheld83/ghactions/Rscript-byod@master",
  needs = "Build Image",
  args = "-e '1+1'"
)

# pasted together, these three blocks make a simple, valid main.workflow file.

# }

Run the code above in your browser using DataLab