From 6d5576804372eaad1d0bf46beb6fd7ce16f33800 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Fri, 1 Sep 2023 13:40:00 -0700 Subject: [PATCH 1/3] final --- R/auth.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/auth.R b/R/auth.R index d81a2c0b..82233776 100644 --- a/R/auth.R +++ b/R/auth.R @@ -10,7 +10,7 @@ get_auth_key <- function() { key <- Sys.getenv("DELPHI_EPIDATA_KEY", unset = "") if (key != "") { - return(key) + return(key) } key <- getOption("delphi.epidata.key", default = "") From ce14aa554d38303e791ef9cb422013a97b44b8f3 Mon Sep 17 00:00:00 2001 From: dshemetov Date: Fri, 1 Sep 2023 20:47:22 +0000 Subject: [PATCH 2/3] docs: document --- man/get_auth_key.Rd | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/man/get_auth_key.Rd b/man/get_auth_key.Rd index 6fcc088d..3372452d 100644 --- a/man/get_auth_key.Rd +++ b/man/get_auth_key.Rd @@ -2,6 +2,17 @@ % Please edit documentation in R/auth.R \name{get_auth_key} \alias{get_auth_key} +\alias{get_auth} +\alias{Get} +\alias{the} +\alias{API} +\alias{key} +\alias{from} +\alias{environment} +\alias{variable} +\alias{`DELPHI_EPIDATA_KEY`} +\alias{or} +\alias{`getOption("delphi.epidata.key")`.} \title{Get the API key} \usage{ get_auth_key() @@ -10,6 +21,5 @@ get_auth_key() The API key } \description{ -Get the API key from the environment variable \code{DELPHI_EPIDATA_KEY} or -\code{getOption("delphi.epidata.key")}. +Get the API key } From 5abad3ed49aa5bf907cc4cd3e7eb6fe8ff3d8fc6 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Fri, 1 Sep 2023 13:49:26 -0700 Subject: [PATCH 3/3] ci: go back to document and style --- .github/workflows/debug.yml | 16 ------ .github/workflows/document.yaml | 42 ++++++++++++++++ .github/workflows/pr-commands.yaml | 79 ------------------------------ .github/workflows/style.yaml | 73 +++++++++++++++++++++++++++ 4 files changed, 115 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/debug.yml create mode 100644 .github/workflows/document.yaml delete mode 100644 .github/workflows/pr-commands.yaml create mode 100644 .github/workflows/style.yaml diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml deleted file mode 100644 index f1bb834e..00000000 --- a/.github/workflows/debug.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help -on: - issue_comment: - types: [created] - -name: Test - -jobs: - test: - runs-on: ubuntu-latest - env: - VAR: ${{ github.event.comment.author_association }} - steps: - - name: Echo - run: | - echo $VAR diff --git a/.github/workflows/document.yaml b/.github/workflows/document.yaml new file mode 100644 index 00000000..6a2d5cb5 --- /dev/null +++ b/.github/workflows/document.yaml @@ -0,0 +1,42 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + paths: ["R/**"] + +name: Document + +jobs: + document: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install dependencies + uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::roxygen2 + needs: roxygen2 + + - name: Document + run: roxygen2::roxygenise() + shell: Rscript {0} + + - name: Commit and push changes + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add man/\* NAMESPACE DESCRIPTION + git commit -m "Update documentation" || echo "No changes to commit" + git pull --rebase + git push origin diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml deleted file mode 100644 index e3a277f8..00000000 --- a/.github/workflows/pr-commands.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help -on: - issue_comment: - types: [created] - -name: Commands - -jobs: - document: - if: ${{ github.event.issue.pull_request && (contains(github.event.comment.author_association, 'MEMBER') || contains(github.event.comment.author_association, 'OWNER') || contains(github.event.comment.author_association, 'COLLABORATOR')) && startsWith(github.event.comment.body, '/document') }} - name: document - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/pr-fetch@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::roxygen2 - needs: pr-document - - - name: Document - run: roxygen2::roxygenise() - shell: Rscript {0} - - - name: commit - 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 'docs: document' - - - uses: r-lib/actions/pr-push@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - style: - if: ${{ github.event.issue.pull_request && (contains(github.event.comment.author_association, 'MEMBER') || contains(github.event.comment.author_association, 'OWNER') || contains(github.event.comment.author_association, 'COLLABORATOR')) && startsWith(github.event.comment.body, '/document') }} - name: style - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/pr-fetch@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - uses: r-lib/actions/setup-r@v2 - - - name: Install dependencies - run: install.packages("styler") - shell: Rscript {0} - - - name: Style - run: styler::style_pkg() - shell: Rscript {0} - - - name: commit - 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: styler' - - - uses: r-lib/actions/pr-push@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml new file mode 100644 index 00000000..650da891 --- /dev/null +++ b/.github/workflows/style.yaml @@ -0,0 +1,73 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw", "**.[rR]profile"] + +name: Style + +jobs: + style: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install dependencies + uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::styler, any::roxygen2 + needs: styler + + - name: Enable styler cache + run: styler::cache_activate() + shell: Rscript {0} + + - name: Determine cache location + id: styler-location + run: | + cat( + "location=", + styler::cache_info(format = "tabular")$location, + "\n", + file = Sys.getenv("GITHUB_OUTPUT"), + append = TRUE, + sep = "" + ) + shell: Rscript {0} + + - name: Cache styler + uses: actions/cache@v3 + with: + path: ${{ steps.styler-location.outputs.location }} + key: ${{ runner.os }}-styler-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-styler- + ${{ runner.os }}- + + - name: Style + run: styler::style_pkg() + shell: Rscript {0} + + - name: Commit and push changes + run: | + if FILES_TO_COMMIT=($(git diff-index --name-only ${{ github.sha }} \ + | egrep --ignore-case '\.(R|[qR]md|Rmarkdown|Rnw|Rprofile)$')) + then + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git commit ${FILES_TO_COMMIT[*]} -m "Style code (GHA)" + git pull --rebase + git push origin + else + echo "No changes to commit." + fi