actions

actions

Download and use GitHub Actions workflow files.

See Also

get_latest_release_tag : Get the latest release tag from a GitHub repository.

Examples

>>> use_github_action("docs-mkdocs")
>>> use_github_action("docs-mkdocs", ref="v1.0.0")
>>> use_github_action("docs-mkdocs", save_as="custom/path/example-action.yml")

Functions

Name Description
set_output Set a GitHub Actions output variable.
use_github_action Download an example GitHub Actions workflow file from CCBR/actions.

set_output

actions.set_output(name, value, environ='GITHUB_OUTPUT')

Set a GitHub Actions output variable.

Write the given name and value to the GitHub Actions environment file specified by the GITHUB_OUTPUT environment variable. You can then access the variable in GitHub Actions using ${{ steps.<step_id>.outputs.<name> }}.

Parameters

Name Type Description Default
name str The name of the output variable to set. required
value str The value of the output variable to set. required
environ str The environment variable that specifies the GitHub Actions environment file. Defaults to “GITHUB_OUTPUT”. 'GITHUB_OUTPUT'

Examples

>>> set_output("VERSION", "1.0.0")
>>> set_output("ALIAS", "latest")

use_github_action

actions.use_github_action(
    name,
    ref=None,
    url=None,
    save_as=None,
    repo='CCBR/actions',
)

Download an example GitHub Actions workflow file from CCBR/actions.

This function was inspired by {usethis}: https://usethis.r-lib.org/reference/github_actions.html

Parameters

Name Type Description Default
name str The name of the GitHub Actions workflow file to download. required
ref str The git reference (branch, tag, or commit SHA) to use. Defaults to None, in which case the latest release or “main” is used. None
url str The URL to download the workflow file from. Defaults to building it based on the repo and ref. None
save_as str The path to save the downloaded workflow file. Defaults to building it based on .github/workflows/name.yml. None
repo str The GitHub repository to download the workflow file from. Defaults to “CCBR/actions”. 'CCBR/actions'

See Also

get_latest_release_tag: Get the latest release tag from a GitHub repository. get_docs_version: Get the documentation version and alias.

Notes

If ref is not provided, the latest release tag is used (if available) or main. If url is not provided, the URL is constructed based on the repository and reference. If save_as is not provided, the file is saved in the .github/workflows directory.

Examples

>>> use_github_action("docs-mkdocs")
>>> use_github_action("docs-mkdocs", ref="v1.0.0")
>>> use_github_action("docs-mkdocs", save_as="custom/path/example-action.yml")