-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cab68aa
Add document workflow
arisp99 a54b81c
Add style workflow
arisp99 a5d5ede
Pull before push
arisp99 7d0d6e5
Add new workflows to README
arisp99 9a30bc9
Fix section ordering
arisp99 69a7a3d
Revert "Fix section ordering"
arisp99 5abf4b2
Add needs field to r dependencies action
arisp99 056dc91
Let `pull` and `push` fail
arisp99 4e2199a
Cache styler
arisp99 7277313
Add github SHA to cache key and add restore-keys
arisp99 3a2e1da
Expand loc to location
arisp99 87a5abc
Broaden action triggers and style more file extensions
arisp99 d0ab4d0
Set paths as file extensions rather than directories
arisp99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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")` | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: ["**.[rR]", "**.[rR]md", "**.[rR]markdown", "**.[rR]nw"] | ||
| pull_request: | ||
| paths: ["**.[rR]", "**.[rR]md", "**.[rR]markdown", "**.[rR]nw"] | ||
|
|
||
| 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 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.