|
| 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 |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +name: pr-commands.yaml |
| 8 | + |
| 9 | +permissions: read-all |
| 10 | + |
| 11 | +jobs: |
| 12 | + 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') }} |
| 14 | + name: document |
| 15 | + runs-on: ubuntu-latest |
| 16 | + env: |
| 17 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - uses: r-lib/actions/pr-fetch@v2 |
| 24 | + with: |
| 25 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 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 | + |
| 36 | + - name: Document |
| 37 | + run: roxygen2::roxygenise() |
| 38 | + shell: Rscript {0} |
| 39 | + |
| 40 | + - name: commit |
| 41 | + run: | |
| 42 | + git config --local user.name "$GITHUB_ACTOR" |
| 43 | + git config --local user.email "[email protected]" |
| 44 | + git add man/\* NAMESPACE |
| 45 | + git commit -m 'Document' |
| 46 | +
|
| 47 | + - uses: r-lib/actions/pr-push@v2 |
| 48 | + with: |
| 49 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + |
| 51 | + 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') }} |
| 53 | + name: style |
| 54 | + runs-on: ubuntu-latest |
| 55 | + env: |
| 56 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + permissions: |
| 58 | + contents: write |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - uses: r-lib/actions/pr-fetch@v2 |
| 63 | + with: |
| 64 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + |
| 66 | + - uses: r-lib/actions/setup-r@v2 |
| 67 | + |
| 68 | + - name: Install dependencies |
| 69 | + run: install.packages("styler") |
| 70 | + shell: Rscript {0} |
| 71 | + |
| 72 | + - name: Style |
| 73 | + run: styler::style_pkg() |
| 74 | + shell: Rscript {0} |
| 75 | + |
| 76 | + - name: commit |
| 77 | + run: | |
| 78 | + git config --local user.name "$GITHUB_ACTOR" |
| 79 | + git config --local user.email "[email protected]" |
| 80 | + git add \*.R |
| 81 | + git commit -m 'Style' |
| 82 | +
|
| 83 | + - uses: r-lib/actions/pr-push@v2 |
| 84 | + with: |
| 85 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments