|
| 1 | +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples |
| 2 | +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help |
1 | 3 | on:
|
2 | 4 | issue_comment:
|
3 | 5 | types: [created]
|
| 6 | + |
4 | 7 | name: Commands
|
| 8 | + |
5 | 9 | jobs:
|
6 | 10 | document:
|
7 |
| - if: startsWith(github.event.comment.body, '/document') |
| 11 | + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }} |
8 | 12 | name: document
|
9 |
| - runs-on: macOS-latest |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
10 | 16 | steps:
|
11 |
| - - uses: actions/checkout@v2 |
12 |
| - - uses: r-lib/actions/pr-fetch@master |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + |
| 19 | + - uses: r-lib/actions/pr-fetch@v2 |
13 | 20 | with:
|
14 | 21 | repo-token: ${{ secrets.GITHUB_TOKEN }}
|
15 |
| - - uses: r-lib/actions/setup-r@master |
16 |
| - - name: Install dependencies |
17 |
| - run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)' |
| 22 | + |
| 23 | + - uses: r-lib/actions/setup-r@v2 |
| 24 | + with: |
| 25 | + use-public-rspm: true |
| 26 | + |
| 27 | + - uses: r-lib/actions/setup-r-dependencies@v2 |
| 28 | + with: |
| 29 | + extra-packages: any::roxygen2 |
| 30 | + needs: pr-document |
| 31 | + |
18 | 32 | - name: Document
|
19 |
| - run: Rscript -e 'roxygen2::roxygenise()' |
| 33 | + run: roxygen2::roxygenise() |
| 34 | + shell: Rscript {0} |
| 35 | + |
20 | 36 | - name: commit
|
21 | 37 | run: |
|
| 38 | + git config --local user.name "$GITHUB_ACTOR" |
| 39 | + git config --local user.email "[email protected]" |
22 | 40 | git add man/\* NAMESPACE
|
23 | 41 | git commit -m 'Document'
|
24 |
| - - uses: r-lib/actions/pr-push@master |
| 42 | +
|
| 43 | + - uses: r-lib/actions/pr-push@v2 |
25 | 44 | with:
|
26 | 45 | repo-token: ${{ secrets.GITHUB_TOKEN }}
|
| 46 | + |
27 | 47 | style:
|
28 |
| - if: startsWith(github.event.comment.body, '/style') |
| 48 | + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} |
29 | 49 | name: style
|
30 |
| - runs-on: macOS-latest |
| 50 | + runs-on: ubuntu-latest |
| 51 | + env: |
| 52 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
31 | 53 | steps:
|
32 |
| - - uses: actions/checkout@v2 |
33 |
| - - uses: r-lib/actions/pr-fetch@master |
| 54 | + - uses: actions/checkout@v3 |
| 55 | + |
| 56 | + - uses: r-lib/actions/pr-fetch@v2 |
34 | 57 | with:
|
35 | 58 | repo-token: ${{ secrets.GITHUB_TOKEN }}
|
36 |
| - - uses: r-lib/actions/setup-r@master |
| 59 | + |
| 60 | + - uses: r-lib/actions/setup-r@v2 |
| 61 | + |
37 | 62 | - name: Install dependencies
|
38 |
| - run: Rscript -e 'install.packages("styler")' |
| 63 | + run: install.packages("styler") |
| 64 | + shell: Rscript {0} |
| 65 | + |
39 | 66 | - name: Style
|
40 |
| - run: Rscript -e 'styler::style_pkg()' |
| 67 | + run: styler::style_pkg() |
| 68 | + shell: Rscript {0} |
| 69 | + |
41 | 70 | - name: commit
|
42 | 71 | run: |
|
| 72 | + git config --local user.name "$GITHUB_ACTOR" |
| 73 | + git config --local user.email "[email protected]" |
43 | 74 | git add \*.R
|
44 | 75 | git commit -m 'Style'
|
45 |
| - - uses: r-lib/actions/pr-push@master |
| 76 | +
|
| 77 | + - uses: r-lib/actions/pr-push@v2 |
46 | 78 | with:
|
47 | 79 | repo-token: ${{ secrets.GITHUB_TOKEN }}
|
48 |
| - # A mock job just to ensure we have a successful build status |
49 |
| - finish: |
50 |
| - runs-on: ubuntu-latest |
51 |
| - steps: |
52 |
| - - run: true |
|
0 commit comments