usethis::use_tidy_github_actions()
diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml
new file mode 100644
index 0000000..1cdafbf
--- /dev/null
+++ b/.github/workflows/pr-commands.yaml
@@ -0,0 +1,75 @@
+# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
+# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
+on:
+ issue_comment:
+ types: [created]
+
+name: Commands
+
+jobs:
+ document:
+ if: startsWith(github.event.comment.body, '/document')
+ name: document
+ runs-on: ubuntu-latest
+ env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: r-lib/actions/pr-fetch@v1
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+
+ - uses: r-lib/actions/setup-r@v1
+ with:
+ use-public-rspm: true
+
+ - uses: r-lib/actions/setup-r-dependencies@v1
+ with:
+ extra-packages: roxygen2
+
+ - 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@v1
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+
+ style:
+ if: startsWith(github.event.comment.body, '/style')
+ name: style
+ runs-on: ubuntu-latest
+ env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: r-lib/actions/pr-fetch@v1
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+
+ - uses: r-lib/actions/setup-r@v1
+
+ - name: Install dependencies
+ run: Rscript -e 'install.packages("styler")'
+
+ - name: Style
+ run: Rscript -e 'styler::style_pkg()'
+
+ - name: commit
+ run: |
+ git config --local user.name "$GITHUB_ACTOR"
+ git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
+ git add \*.R
+ git commit -m 'Style'
+
+ - uses: r-lib/actions/pr-push@v1
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}