|
| 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] |
4 | | -name: Commands |
| 6 | + |
| 7 | +name: pr-commands.yaml |
| 8 | + |
| 9 | +permissions: read-all |
| 10 | + |
5 | 11 | jobs: |
6 | 12 | document: |
7 | | - if: startsWith(github.event.comment.body, '/document') |
| 13 | + 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 | 14 | name: document |
9 | | - runs-on: macOS-latest |
| 15 | + runs-on: ubuntu-latest |
10 | 16 | env: |
11 | 17 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 18 | + permissions: |
| 19 | + contents: write |
12 | 20 | steps: |
13 | | - - uses: actions/checkout@v2 |
14 | | - - uses: r-lib/actions/pr-fetch@master |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - uses: r-lib/actions/pr-fetch@v2 |
15 | 24 | with: |
16 | 25 | repo-token: ${{ secrets.GITHUB_TOKEN }} |
17 | | - - uses: r-lib/actions/setup-r@master |
18 | | - - name: Install dependencies |
19 | | - run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)' |
| 26 | + |
| 27 | + - uses: r-lib/actions/setup-r@v2 |
| 28 | + with: |
| 29 | + use-public-rspm: true |
| 30 | + |
| 31 | + - uses: r-lib/actions/setup-r-dependencies@v2 |
| 32 | + with: |
| 33 | + extra-packages: any::roxygen2 |
| 34 | + needs: pr-document |
| 35 | + |
20 | 36 | - name: Document |
21 | | - run: Rscript -e 'roxygen2::roxygenise()' |
| 37 | + run: roxygen2::roxygenise() |
| 38 | + shell: Rscript {0} |
| 39 | + |
22 | 40 | - name: commit |
23 | 41 | run: | |
| 42 | + git config --local user.name "$GITHUB_ACTOR" |
| 43 | + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" |
24 | 44 | git add man/\* NAMESPACE |
25 | 45 | git commit -m 'Document' |
26 | | - - uses: r-lib/actions/pr-push@master |
| 46 | +
|
| 47 | + - uses: r-lib/actions/pr-push@v2 |
27 | 48 | with: |
28 | 49 | repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + |
29 | 51 | style: |
30 | | - if: startsWith(github.event.comment.body, '/style') |
| 52 | + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} |
31 | 53 | name: style |
32 | | - runs-on: macOS-latest |
| 54 | + runs-on: ubuntu-latest |
33 | 55 | env: |
34 | 56 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + permissions: |
| 58 | + contents: write |
35 | 59 | steps: |
36 | | - - uses: actions/checkout@v2 |
37 | | - - uses: r-lib/actions/pr-fetch@master |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - uses: r-lib/actions/pr-fetch@v2 |
38 | 63 | with: |
39 | 64 | repo-token: ${{ secrets.GITHUB_TOKEN }} |
40 | | - - uses: r-lib/actions/setup-r@master |
| 65 | + |
| 66 | + - uses: r-lib/actions/setup-r@v2 |
| 67 | + |
41 | 68 | - name: Install dependencies |
42 | | - run: Rscript -e 'install.packages("styler")' |
| 69 | + run: install.packages("styler") |
| 70 | + shell: Rscript {0} |
| 71 | + |
43 | 72 | - name: Style |
44 | | - run: Rscript -e 'styler::style_pkg()' |
| 73 | + run: styler::style_pkg() |
| 74 | + shell: Rscript {0} |
| 75 | + |
45 | 76 | - name: commit |
46 | 77 | run: | |
| 78 | + git config --local user.name "$GITHUB_ACTOR" |
| 79 | + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" |
47 | 80 | git add \*.R |
48 | 81 | git commit -m 'Style' |
49 | | - - uses: r-lib/actions/pr-push@master |
| 82 | +
|
| 83 | + - uses: r-lib/actions/pr-push@v2 |
50 | 84 | with: |
51 | 85 | repo-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments