1
1
# Reproduce locally by running:
2
2
# ```r
3
- # pak::pak(c("any::rmarkdown", "any::usethis", "."))
3
+ # pak::pak(c("any::rmarkdown", "any::usethis", "any::allcontributors", " ."))
4
4
# writeLines(
5
5
# knitr::knit_expand(
6
6
# "README.Rmd",
42
42
GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
43
43
steps :
44
44
- name : Checkout repos
45
- uses : actions/checkout@v3
45
+ uses : actions/checkout@v4
46
46
47
47
- name : Setup R
48
48
uses : r-lib/actions/setup-r@v2
55
55
- name : Install dependencies
56
56
uses : r-lib/actions/setup-r-dependencies@v2
57
57
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}
59
64
60
65
- name : Compile the readme
61
66
run : |
@@ -74,16 +79,22 @@ jobs:
74
79
)
75
80
shell : Rscript {0}
76
81
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