-
Notifications
You must be signed in to change notification settings - Fork 61
41 lines (34 loc) · 1.1 KB
/
update_github_meta.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
on:
push:
branches:
- gh-pages
schedule:
- cron: '15 14 * * *'
name: "Update github_meta.json"
jobs:
update_github_meta:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
- name: Update and commit
run: |
# Update github_meta.json
Rscript ./scripts/github_meta.R
# detect changes (the code is derived from https://stackoverflow.com/a/3879077)
git add ./github_meta.json
git update-index --refresh
if ! git diff-index --quiet HEAD -- ./github_meta.json; then
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
git commit -m "Update github_meta.json [skip ci]"
git push origin "${{ github.ref }}"
else
echo "No changes"
fi