Skip to content

Commit 68329d4

Browse files
committed
update render readme action
1 parent dbf85c1 commit 68329d4

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

.github/workflows/render_readme.yml

+27-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Reproduce locally by running:
22
# ```r
3-
# pak::pak(c("any::rmarkdown", "any::usethis", "."))
3+
# pak::pak(c("any::rmarkdown", "any::usethis", "any::allcontributors", "."))
44
# writeLines(
55
# knitr::knit_expand(
66
# "README.Rmd",
@@ -42,7 +42,7 @@ jobs:
4242
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
4343
steps:
4444
- name: Checkout repos
45-
uses: actions/checkout@v3
45+
uses: actions/checkout@v4
4646

4747
- name: Setup R
4848
uses: r-lib/actions/setup-r@v2
@@ -55,7 +55,12 @@ jobs:
5555
- name: Install dependencies
5656
uses: r-lib/actions/setup-r-dependencies@v2
5757
with:
58-
extra-packages: any::rmarkdown, local::.
58+
extra-packages: any::rmarkdown, any::allcontributors, local::.
59+
60+
- name: Update contributors
61+
if: github.ref == 'refs/heads/main'
62+
run: allcontributors::add_contributors(format = "text")
63+
shell: Rscript {0}
5964

6065
- name: Compile the readme
6166
run: |
@@ -74,16 +79,22 @@ jobs:
7479
)
7580
shell: Rscript {0}
7681

77-
- name: Commit files
78-
run: |
79-
git config --local user.email "action@github.com"
80-
git config --local user.name "GitHub Action"
81-
git add README.md
82-
# Also add README figures if they exist
83-
if [ -d man/figures ]
84-
then
85-
git add man/figures/
86-
fi
87-
git diff-index --quiet HEAD || git commit -m "Automatic readme update"
88-
git pull --rebase origin ${{ github.ref.name }}
89-
git push origin || echo "No changes to push"
82+
- name: Upload README.md as an artifact
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: readme
86+
path: README.md
87+
88+
- name: Create Pull Request
89+
if: github.ref == 'refs/heads/main'
90+
uses: peter-evans/create-pull-request@v7
91+
with:
92+
commit-message: "Automatic README update"
93+
title: "Update README"
94+
body: "This is an automated pull request to update the README."
95+
branch: "update-readme-${{ github.run_number }}"
96+
labels: "documentation"
97+
add-paths: |
98+
README.Rmd
99+
README.md
100+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)