|
| 1 | +# Workflow derived from https://github.com/r-lib/actions/tree/master/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: Commands |
| 8 | + |
| 9 | +jobs: |
| 10 | + document: |
| 11 | + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR') && startsWith(github.event.comment.body, '/document') }} |
| 12 | + name: document |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - uses: r-lib/actions/pr-fetch@v2 |
| 20 | + with: |
| 21 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 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: roxygen2 |
| 30 | + |
| 31 | + - name: Document |
| 32 | + run: Rscript -e 'roxygen2::roxygenise()' |
| 33 | + |
| 34 | + - name: commit |
| 35 | + run: | |
| 36 | + git config --local user.name "$GITHUB_ACTOR" |
| 37 | + git config --local user.email "[email protected]" |
| 38 | + git add man/\* NAMESPACE |
| 39 | + git commit -m 'Document' |
| 40 | + - uses: r-lib/actions/pr-push@v2 |
| 41 | + with: |
| 42 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + |
| 44 | + style: |
| 45 | + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR') && startsWith(github.event.comment.body, '/style') }} |
| 46 | + name: style |
| 47 | + runs-on: ubuntu-latest |
| 48 | + env: |
| 49 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + |
| 53 | + - uses: r-lib/actions/pr-fetch@v2 |
| 54 | + with: |
| 55 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + |
| 57 | + - uses: r-lib/actions/setup-r@v2 |
| 58 | + |
| 59 | + - name: Install dependencies |
| 60 | + run: Rscript -e 'install.packages(c("styler", "roxygen2"))' |
| 61 | + |
| 62 | + - name: Style |
| 63 | + run: Rscript -e 'styler::style_pkg()' |
| 64 | + |
| 65 | + - name: Install Air |
| 66 | + uses: posit-dev/setup-air@v1 |
| 67 | + |
| 68 | + - name: Check |
| 69 | + run: air format . --check |
| 70 | + |
| 71 | + - name: commit |
| 72 | + run: | |
| 73 | + git config --local user.name "$GITHUB_ACTOR" |
| 74 | + git config --local user.email "[email protected]" |
| 75 | + git add \*.R |
| 76 | + git commit -m 'Style' |
| 77 | + - uses: r-lib/actions/pr-push@v2 |
| 78 | + with: |
| 79 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + |
| 81 | + update_wordlist: |
| 82 | + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR') && startsWith(github.event.comment.body, '/update_wordlist') }} |
| 83 | + name: update_wordlist |
| 84 | + runs-on: ubuntu-latest |
| 85 | + env: |
| 86 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - uses: r-lib/actions/pr-fetch@v2 |
| 91 | + with: |
| 92 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + |
| 94 | + - uses: r-lib/actions/setup-r@v2 |
| 95 | + |
| 96 | + - name: Install dependencies |
| 97 | + run: | |
| 98 | + install.packages(c("spelling")) |
| 99 | + shell: Rscript {0} |
| 100 | + |
| 101 | + - name: Update wordlist |
| 102 | + run: | |
| 103 | + spelling::update_wordlist(confirm = TRUE) |
| 104 | + shell: Rscript {0} |
| 105 | + |
| 106 | + - name: Commit changes |
| 107 | + run: | |
| 108 | + git config --local user.name "$GITHUB_ACTOR" |
| 109 | + git config --local user.email "[email protected]" |
| 110 | + git add inst/WORDLIST |
| 111 | + git commit -m 'Update wordlist' || echo "No changes to commit" |
| 112 | +
|
| 113 | + - uses: r-lib/actions/pr-push@v2 |
| 114 | + with: |
| 115 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments