From e93380b5c1bd6d7730b37be8f54e5a78eeb5d91d Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 14 Oct 2025 11:43:32 -0400 Subject: [PATCH 1/4] remove document command, add auto document workflow --- .github/workflows/document.yaml | 44 ++++++++++++++++++++++++++++++ .github/workflows/pr-commands.yaml | 37 ------------------------- 2 files changed, 44 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/document.yaml diff --git a/.github/workflows/document.yaml b/.github/workflows/document.yaml new file mode 100644 index 00000000..c7841e60 --- /dev/null +++ b/.github/workflows/document.yaml @@ -0,0 +1,44 @@ +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 + # Only commit if there are staged changes + git diff --staged --quiet || git commit -m 'Update documentation' + + - 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..4ab0b449 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -56,43 +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 - 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: Rscript -e 'roxygen2::roxygenise()' - - - 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 'Document' - - - uses: r-lib/actions/pr-push@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - style: if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} name: style From d8783f55507842283da5815795f15b1a0f0b33af Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 14 Oct 2025 11:51:53 -0400 Subject: [PATCH 2/4] simplify --- .github/workflows/document.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/document.yaml b/.github/workflows/document.yaml index c7841e60..c1ca024a 100644 --- a/.github/workflows/document.yaml +++ b/.github/workflows/document.yaml @@ -36,8 +36,7 @@ jobs: git config --local user.name "github-actions[bot]" git config --local user.email "github-actions[bot]@users.noreply.github.com" git add man/\* NAMESPACE - # Only commit if there are staged changes - git diff --staged --quiet || git commit -m 'Update documentation' + git commit -m 'Update documentation' || echo "No changes to commit" - uses: r-lib/actions/pr-push@v2 with: From cf10625dc4f240218af1bec0be9236552917e1e9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 14 Oct 2025 15:56:39 +0000 Subject: [PATCH 3/4] Update documentation --- man/bundle_dir.Rd | 2 +- man/bundle_path.Rd | 2 +- man/bundle_static.Rd | 2 +- man/connect.Rd | 2 +- man/deploy.Rd | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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")) From 860052e414a278b236df02affdd728d040f30a44 Mon Sep 17 00:00:00 2001 From: Toph Allen Date: Tue, 14 Oct 2025 19:21:13 -0400 Subject: [PATCH 4/4] restore document pr command --- .github/workflows/pr-commands.yaml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index 4ab0b449..b5a77f62 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -56,6 +56,42 @@ 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 + 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: Rscript -e 'roxygen2::roxygenise()' + + - 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 'Document' + + - uses: r-lib/actions/pr-push@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + style: if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} name: style