blob: 71f335b3ea347ab44880cdfd17785811642b299b [file] [log] [blame]
Christophe Dervieux7d613ee2023-03-24 17:35:02 +01001# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
christophe dervieux76d730d2021-09-15 15:02:02 +02002# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3on:
4 issue_comment:
5 types: [created]
6
7name: Commands
8
9jobs:
10 document:
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010011 if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
christophe dervieux76d730d2021-09-15 15:02:02 +020012 name: document
13 runs-on: ubuntu-latest
14 env:
15 GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16 steps:
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010017 - uses: actions/checkout@v3
christophe dervieux76d730d2021-09-15 15:02:02 +020018
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010019 - uses: r-lib/actions/pr-fetch@v2
christophe dervieux76d730d2021-09-15 15:02:02 +020020 with:
21 repo-token: ${{ secrets.GITHUB_TOKEN }}
22
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010023 - uses: r-lib/actions/setup-r@v2
christophe dervieux76d730d2021-09-15 15:02:02 +020024 with:
25 use-public-rspm: true
26
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010027 - uses: r-lib/actions/setup-r-dependencies@v2
christophe dervieux76d730d2021-09-15 15:02:02 +020028 with:
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010029 extra-packages: any::roxygen2
30 needs: pr-document
christophe dervieux76d730d2021-09-15 15:02:02 +020031
32 - name: Document
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010033 run: roxygen2::roxygenise()
34 shell: Rscript {0}
christophe dervieux76d730d2021-09-15 15:02:02 +020035
36 - name: commit
37 run: |
38 git config --local user.name "$GITHUB_ACTOR"
39 git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
40 git add man/\* NAMESPACE
41 git commit -m 'Document'
42
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010043 - uses: r-lib/actions/pr-push@v2
christophe dervieux76d730d2021-09-15 15:02:02 +020044 with:
45 repo-token: ${{ secrets.GITHUB_TOKEN }}
46
47 style:
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010048 if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
christophe dervieux76d730d2021-09-15 15:02:02 +020049 name: style
50 runs-on: ubuntu-latest
51 env:
52 GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
53 steps:
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010054 - uses: actions/checkout@v3
christophe dervieux76d730d2021-09-15 15:02:02 +020055
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010056 - uses: r-lib/actions/pr-fetch@v2
christophe dervieux76d730d2021-09-15 15:02:02 +020057 with:
58 repo-token: ${{ secrets.GITHUB_TOKEN }}
59
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010060 - uses: r-lib/actions/setup-r@v2
christophe dervieux76d730d2021-09-15 15:02:02 +020061
62 - name: Install dependencies
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010063 run: install.packages("styler")
64 shell: Rscript {0}
christophe dervieux76d730d2021-09-15 15:02:02 +020065
66 - name: Style
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010067 run: styler::style_pkg()
68 shell: Rscript {0}
christophe dervieux76d730d2021-09-15 15:02:02 +020069
70 - name: commit
71 run: |
72 git config --local user.name "$GITHUB_ACTOR"
73 git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
74 git add \*.R
75 git commit -m 'Style'
76
Christophe Dervieux7d613ee2023-03-24 17:35:02 +010077 - uses: r-lib/actions/pr-push@v2
christophe dervieux76d730d2021-09-15 15:02:02 +020078 with:
79 repo-token: ${{ secrets.GITHUB_TOKEN }}