diff --git a/.github/workflows/document.yaml b/.github/workflows/document.yaml new file mode 100644 index 00000000..c1ca024a --- /dev/null +++ b/.github/workflows/document.yaml @@ -0,0 +1,43 @@ +name: Document + +on: + pull_request: + branches: + - main + +jobs: + document: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v4 + + - 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 changes + run: | + git config --local user.name "github-actions[bot]" + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git add man/\* NAMESPACE + git commit -m 'Update documentation' || echo "No changes to commit" + + - uses: r-lib/actions/pr-push@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index 1cbe1626..b5a77f62 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -56,7 +56,6 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} - document: if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }} name: document diff --git a/man/bundle_dir.Rd b/man/bundle_dir.Rd index 272fd84a..47d7c865 100644 --- a/man/bundle_dir.Rd +++ b/man/bundle_dir.Rd @@ -21,7 +21,7 @@ Bundle A bundle object Creates a bundle from a target directory. } \examples{ -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} bundle_dir(system.file("tests/testthat/examples/shiny/", package = "connectapi")) \dontshow{\}) # examplesIf} diff --git a/man/bundle_path.Rd b/man/bundle_path.Rd index 7eff4f3c..586e0d11 100644 --- a/man/bundle_path.Rd +++ b/man/bundle_path.Rd @@ -16,7 +16,7 @@ Bundle A bundle object Define a bundle from a path (a path directly to a tar.gz file) } \examples{ -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} bundle_path(system.file("tests/testthat/examples/static.tar.gz", package = "connectapi")) \dontshow{\}) # examplesIf} diff --git a/man/bundle_static.Rd b/man/bundle_static.Rd index bc855f14..0a755959 100644 --- a/man/bundle_static.Rd +++ b/man/bundle_static.Rd @@ -26,7 +26,7 @@ directory, generates a basic manifest file (using the first file as the NOTE: the \code{rsconnect} package is required for this function to work properly. } \examples{ -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} bundle_static(system.file("logo.png", package = "connectapi")) \dontshow{\}) # examplesIf} diff --git a/man/connect.Rd b/man/connect.Rd index 70c3fd7a..c0b68c18 100644 --- a/man/connect.Rd +++ b/man/connect.Rd @@ -75,7 +75,7 @@ fallback_key <- Sys.getenv("VIEWER_ROLE_API_KEY") client <- connect(token = token, token_local_testing_key = fallback_key) } -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} # default is to read CONNECT_SERVER and CONNECT_API_KEY environment variables # this example will read TEST_1_SERVER and TEST_1_API_KEY diff --git a/man/deploy.Rd b/man/deploy.Rd index b126c199..394ce63a 100644 --- a/man/deploy.Rd +++ b/man/deploy.Rd @@ -60,7 +60,7 @@ bnd <- bundle_dir(".") deploy(client, bnd) } -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} client <- connect(prefix = "TEST_1") bnd <- bundle_path(system.file("tests/testthat/examples/static.tar.gz", package = "connectapi"))