diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index f99ab7e5..470c37d0 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -5,7 +5,6 @@ on: branches: [main, master] release: types: [published] - workflow_dispatch: name: pkgdown diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index d5ae3c21..374c918e 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -3,13 +3,11 @@ on: push: branches: [main, master] - workflow_dispatch: + pull_request: + branches: [main, master] name: Style and Doc -permissions: - contents: write - jobs: document: name: document @@ -53,14 +51,21 @@ jobs: run: roxygen2::roxygenise() shell: Rscript {0} + - name: Changes Check + id: verify_diff + run: | + git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT + - name: commit + if: steps.verify_diff.outputs.changed == 'true' && github.event_name == 'push' run: | git config --local user.name "$GITHUB_ACTOR" git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" git add man/\* NAMESPACE - git commit -m 'Document' + git commit -m 'GH Actions Document' - uses: r-lib/actions/pr-push@v2 + if: steps.verify_diff.outputs.changed == 'true' && github.event_name == 'push' with: repo-token: ${{ secrets.GITHUB_TOKEN }} @@ -86,13 +91,20 @@ jobs: run: styler::style_pkg() shell: Rscript {0} + - name: Changes Check + id: verify_diff + run: | + git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT + - name: commit + if: steps.verify_diff.outputs.changed == 'true' && github.event_name == 'push' run: | git config --local user.name "$GITHUB_ACTOR" git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - git add \*.R - git commit -m 'Style' + git add \*.R \vignettes\*.Rmd README.Rmd + git commit -m 'GH Actions Style' - uses: r-lib/actions/pr-push@v2 + if: steps.verify_diff.outputs.changed == 'true' && github.event_name == 'push' with: repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/R/load_schedule.R b/R/load_schedule.R index 7ac39a85..dc5a03c0 100644 --- a/R/load_schedule.R +++ b/R/load_schedule.R @@ -6,7 +6,7 @@ #' @param season number from 1950 to current season (defaults to current season). `'current'` also accepted. #' @importFrom magrittr "%>%" #' @keywords internal -#' @return A tibble with one row per circuit in season +#' @return A tibble with one row per round in season. Indicates in sprint_date if a specific round has a sprint race .load_schedule <- function(season = get_current_season()) { if (season != "current" && (season < 1950 || season > get_current_season())) { cli::cli_abort('{.var season} must be between 1950 and {get_current_season()} (or use "current")') @@ -36,7 +36,7 @@ janitor::clean_names() } else if (season < 2021) { data$MRData$RaceTable$Races %>% - tidyr::unnest(cols = c("Circuit"), names_repair = "universal") %>% + tidyr::unnest(cols = c('Circuit'), names_repair = "universal") %>% janitor::clean_names() %>% suppressWarnings() %>% suppressMessages() %>% @@ -83,7 +83,7 @@ #' @inherit .load_schedule title description params return #' @export #' @examples -#' # Load this year's schedule: +#' # Load this year's schedule. Note the weekends which have sprints #' load_schedule() #' #' # Load the schedule from 2008