Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help |
| 3 | on: |
| 4 | issue_comment: |
| 5 | types: [created] |
| 6 | |
| 7 | name: Commands |
| 8 | |
| 9 | jobs: |
| 10 | document: |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 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') }} |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 12 | name: document |
| 13 | runs-on: ubuntu-latest |
| 14 | env: |
| 15 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 16 | steps: |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 17 | - uses: actions/checkout@v3 |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 18 | |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 19 | - uses: r-lib/actions/pr-fetch@v2 |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 20 | with: |
| 21 | repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 22 | |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 23 | - uses: r-lib/actions/setup-r@v2 |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 24 | with: |
| 25 | use-public-rspm: true |
| 26 | |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 27 | - uses: r-lib/actions/setup-r-dependencies@v2 |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 28 | with: |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 29 | extra-packages: any::roxygen2 |
| 30 | needs: pr-document |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 31 | |
| 32 | - name: Document |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 33 | run: roxygen2::roxygenise() |
| 34 | shell: Rscript {0} |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 35 | |
| 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 Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 43 | - uses: r-lib/actions/pr-push@v2 |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 44 | with: |
| 45 | repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | |
| 47 | style: |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 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') }} |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 49 | name: style |
| 50 | runs-on: ubuntu-latest |
| 51 | env: |
| 52 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 53 | steps: |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 54 | - uses: actions/checkout@v3 |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 55 | |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 56 | - uses: r-lib/actions/pr-fetch@v2 |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 57 | with: |
| 58 | repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 59 | |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 60 | - uses: r-lib/actions/setup-r@v2 |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 61 | |
| 62 | - name: Install dependencies |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 63 | run: install.packages("styler") |
| 64 | shell: Rscript {0} |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 65 | |
| 66 | - name: Style |
Christophe Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 67 | run: styler::style_pkg() |
| 68 | shell: Rscript {0} |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 69 | |
| 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 Dervieux | 7d613ee | 2023-03-24 17:35:02 +0100 | [diff] [blame^] | 77 | - uses: r-lib/actions/pr-push@v2 |
christophe dervieux | 76d730d | 2021-09-15 15:02:02 +0200 | [diff] [blame] | 78 | with: |
| 79 | repo-token: ${{ secrets.GITHUB_TOKEN }} |