Skip to content

Commit

Permalink
Lint all files for workflow dispatch (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif authored May 14, 2024
1 parent 4f708f8 commit 92c8f37
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ jobs:
SKIP_INSTRUCTION: "[skip linter]"

- name: Changed files 🖋️
if: github.event_name != 'workflow_dispatch'
id: files
uses: Ana06/[email protected]
with:
Expand All @@ -155,11 +156,18 @@ jobs:

- name: Lint 🧶
run: |
github_event_name <- "${{ github.event_name }}"
cat(paste0("GitHub event name = ", github_event_name, "\n"))
exclusions_list <- NULL
if (!identical("${{ inputs.lint-all-files }}", "true")) {
if (!(identical("${{ inputs.lint-all-files }}", "true") || identical(github_event_name, "workflow_dispatch"))) {
changed_files <- jsonlite::fromJSON('${{ steps.files.outputs.added_modified }}')
all_files <- list.files(recursive = TRUE)
exclusions_list <- as.list(setdiff(all_files, changed_files))
cat("Linting only changed files:\n")
cat(changed_files)
cat("\n\n")
} else {
cat("Linting all files.\n")
}
lints <- lintr::lint_package(exclusions = exclusions_list)
if (length(lints) > 0L) {
Expand Down

0 comments on commit 92c8f37

Please sign in to comment.