|
| 1 | +name: render-readme |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.head_ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
1 | 7 | on: |
2 | 8 | workflow_dispatch: |
3 | 9 | push: |
4 | | - paths: |
5 | | - - .github/workflows/render-readme.yaml |
6 | | - - 'README.Rmd' |
| 10 | + branches: |
| 11 | + - main |
7 | 12 |
|
8 | 13 | jobs: |
9 | 14 | render-readme: |
10 | | - runs-on: ubuntu-latest |
| 15 | + runs-on: macos-latest |
11 | 16 | env: |
12 | 17 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
13 | 18 | steps: |
14 | | - - uses: actions/checkout@v4 |
| 19 | + - name: Checkout repos |
| 20 | + uses: actions/checkout@v4 |
15 | 21 |
|
16 | | - - uses: r-lib/actions/setup-pandoc@v2 |
| 22 | + - name: Setup R |
| 23 | + uses: r-lib/actions/setup-r@v2 |
17 | 24 |
|
18 | | - - uses: r-lib/actions/setup-r@v2 |
19 | | - with: |
20 | | - use-public-rspm: true |
| 25 | + - name: Setup pandoc |
| 26 | + uses: r-lib/actions/setup-pandoc@v2 |
21 | 27 |
|
22 | | - - uses: r-lib/actions/setup-r-dependencies@v2 |
| 28 | + - name: Install dependencies |
| 29 | + uses: r-lib/actions/setup-r-dependencies@v2 |
23 | 30 | with: |
24 | | - dependencies: NA |
25 | | - extra-packages: | |
26 | | - any::pkgdown |
27 | | - local::. |
| 31 | + extra-packages: any::rmarkdown, any::allcontributors |
| 32 | + |
| 33 | + - name: Update contributors |
| 34 | + if: github.ref == 'refs/heads/main' |
| 35 | + run: allcontributors::add_contributors(format = "text") |
| 36 | + shell: Rscript {0} |
28 | 37 |
|
29 | 38 | - name: Compile the readme |
30 | 39 | run: | |
31 | 40 | rmarkdown::render("README.Rmd") |
32 | 41 | shell: Rscript {0} |
33 | 42 |
|
34 | | - - name: Commit files |
35 | | - run: | |
36 | | - git config --local user.email "[email protected]" |
37 | | - git config --local user.name "GitHub Action" |
38 | | - git add README.md man/figures/ |
39 | | - git diff-index --quiet HEAD || git commit -m "Automatic readme update" |
40 | | - git push origin || echo "No changes to push" |
| 43 | + - name: Upload README.md as an artifact |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: readme |
| 47 | + path: README.md |
| 48 | + |
| 49 | + - name: Create Pull Request |
| 50 | + if: github.ref == 'refs/heads/main' |
| 51 | + uses: peter-evans/create-pull-request@v6 |
| 52 | + with: |
| 53 | + commit-message: "Automatic README update" |
| 54 | + title: "Update README" |
| 55 | + body: "This is an automated pull request to update the README." |
| 56 | + branch: "update-readme-${{ github.run_number }}" |
| 57 | + labels: "documentation" |
| 58 | + add-paths: | |
| 59 | + README.Rmd |
| 60 | + README.md |
| 61 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments