Style Workflow
This GitHub Actions workflow checks and enforces coding style using
styler
on R files. The workflow is triggered manually
(workflow_dispatch
) and can also be invoked as a workflow
call (workflow_call
).
Workflow Structure
The workflow consists of a single job: style
.
style
Job
This job performs code style checks and enforces styling using
styler
.
Steps
- Get branch names: Extracts branch names.
- Checkout repo (PR): Checks out the repository based on the event type (pull request).
- Checkout repository: Checks out the repository for events other than pull requests.
- Normalize inputs: Normalizes the R version input.
- Restore cache: Restores cached dependencies.
- Run Staged dependencies: Runs staged dependencies action.
- Install dependencies from DESCRIPTION: install dependencies from DESCRIPTION (in case of missing dependencies in parent admiralci docker image)
- Get changed files: Retrieves the list of changed files.
-
Run styler: Applies
styler
to the changed R files and checks for style violations. If violations are found, the workflow displays relevant information and version details (files with style violation will be displayed usinggit diff
after running styler on the workflows)
Triggers
-
workflow_dispatch
: Manually triggered workflow with optional inputs. -
workflow_call
: Invoked as a workflow call.
Permissions
-
contents: write
: Write permissions for repository contents.
Note: It’s possible to fix locally style issues using
styler::style_file()
.