Update RSPM link for workflows #20
This file contains 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
on: | |
push: | |
branches: [master, main] | |
permissions: | |
actions: read | |
attestations: read | |
checks: read | |
contents: write | |
deployments: write | |
id-token: write | |
issues: write | |
discussions: none | |
packages: none | |
pages: none | |
pull-requests: write | |
repository-projects: none | |
security-events: none | |
statuses: write | |
name: "Update README/lint package" | |
jobs: | |
Update-readme-md: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: '2.7.3' # The pandoc version to download (if necessary) and use. | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: local::. | |
- name: Render README | |
run: rmarkdown::render("README.Rmd") | |
shell: Rscript {0} | |
- name: Commit and push changes | |
run: | | |
if [[ `git status --porcelain` ]]; then | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
git checkout -b update-readme | |
git add -A | |
git commit -m "Re-render README" | |
git push --set-upstream origin -f update-readme | |
gh pr create -B main -H update-readme --title 'Merge update-readme into main' --body 'Created by Github action' | |
fi | |
lint-package: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: | | |
any::styler | |
any::roxygen2 | |
- name: Lint package | |
run: styler::style_pkg() | |
shell: Rscript {0} | |
- name: Commit and push changes | |
run: | | |
if [[ `git status --porcelain` ]]; then | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
git checkout -b update-lint | |
git add -A | |
git commit -m "Lint package" | |
git push --set-upstream origin -f update-lint | |
gh pr create -B main -H update-lint --title 'Merge update-lint into main' --body 'Created by Github action' | |
fi |