-
Notifications
You must be signed in to change notification settings - Fork 229
Add document and style workflows #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
cab68aa
a54b81c
a5d5ede
7d0d6e5
9a30bc9
69a7a3d
5abf4b2
056dc91
4e2199a
7277313
3a2e1da
87a5abc
d0ab4d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,10 @@ Package workflows: | |
| - [`pkgdown`](#build-pkgdown-site) - Build a | ||
| [pkgdown](https://pkgdown.r-lib.org/) site for an R package and | ||
| deploy it to [GitHub Pages](https://pages.github.com/). | ||
| - [`document`](#document-package) - Run `roxygen2::roxygenise()` on an | ||
| R package. | ||
| - [`style`](#style-package) - Run `styler::style_pkg()` on an R | ||
| package. | ||
|
|
||
| RMarkdown workflows: | ||
|
|
||
|
|
@@ -525,6 +529,113 @@ jobs: | |
| Rscript -e 'pkgdown::build_site(preview = FALSE, install = FALSE)' | ||
| ``` | ||
|
|
||
| ## Document package | ||
|
|
||
| `usethis::use_github_action("document")` | ||
|
|
||
| This example documents an R package whenever a file in the `R/` | ||
| directory changes, then commits and pushes the changes to the same | ||
| branch. | ||
|
|
||
| ``` yaml | ||
| # 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/**"] | ||
| pull_request: | ||
| paths: ["R/**"] | ||
|
|
||
| name: Document | ||
|
|
||
| jobs: | ||
| document: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v2 | ||
| 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 | ||
|
|
||
| - 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 "[email protected]" | ||
| git add man/\* NAMESPACE | ||
| git commit -m "Update documentation" || echo "No changes to commit" | ||
| git pull --ff-only || echo "No remote changes" | ||
| git push origin || echo "No changes to commit" | ||
| ``` | ||
|
|
||
| ## Style package | ||
|
|
||
| `usethis::use_github_action("document")` | ||
|
|
||
| This example styles the R code in a package, then commits and pushes the | ||
| changes to the same branch. | ||
|
|
||
| ``` yaml | ||
| # 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/**"] | ||
| pull_request: | ||
| paths: ["R/**"] | ||
|
|
||
| name: Style | ||
|
|
||
| jobs: | ||
| style: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v2 | ||
| 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 | ||
|
|
||
| - name: Style | ||
| run: styler::style_pkg() | ||
| shell: Rscript {0} | ||
|
|
||
| - name: Commit and push changes | ||
| run: | | ||
| git config --local user.name "$GITHUB_ACTOR" | ||
| git config --local user.email "[email protected]" | ||
| git add R/\* | ||
| git commit -m "Style code" || echo "No changes to commit" | ||
| git pull --ff-only || echo "No remote changes" | ||
| git push origin || echo "No changes to commit" | ||
| ``` | ||
|
|
||
| ## Build bookdown site | ||
|
|
||
| `usethis::use_github_action("bookdown")` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # 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/**"] | ||
| pull_request: | ||
| paths: ["R/**"] | ||
|
|
||
| name: Document | ||
|
|
||
| jobs: | ||
| document: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
gaborcsardi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - 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 | ||
arisp99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 "[email protected]" | ||
| git add man/\* NAMESPACE | ||
| git commit -m "Update documentation" || echo "No changes to commit" | ||
| git pull --ff-only | ||
| git push origin | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # 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/**", "tests/**", "vignettes/**"] | ||
| pull_request: | ||
| paths: ["R/**", "tests/**", "vignettes/**"] | ||
|
||
|
|
||
| name: Style | ||
|
|
||
| jobs: | ||
| style: | ||
gaborcsardi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| runs-on: ubuntu-latest | ||
| env: | ||
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
gaborcsardi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - 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 | ||
arisp99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| needs: styler | ||
|
|
||
| - name: Enable styler cache | ||
| run: styler::cache_activate() | ||
| shell: Rscript {0} | ||
|
|
||
| - name: Determine cache location | ||
| id: styler-location | ||
| run: | | ||
| cat( | ||
| "##[set-output name=location;]", | ||
| styler::cache_info(format = "tabular")$location, | ||
arisp99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "\n", | ||
| sep = "" | ||
| ) | ||
| shell: Rscript {0} | ||
|
|
||
| - name: Cache styler | ||
| uses: actions/cache@v2 | ||
| 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(filetype = c(".R", ".Rmd", ".Rmarkdown", ".Rnw")) | ||
| shell: Rscript {0} | ||
|
|
||
| - name: Commit and push changes | ||
| run: | | ||
| git config --local user.name "$GITHUB_ACTOR" | ||
| git config --local user.email "[email protected]" | ||
| git add R/\* | ||
| git commit -m "Style code" || echo "No changes to commit" | ||
| git pull --ff-only | ||
| git push origin | ||
Uh oh!
There was an error while loading. Please reload this page.