-
Notifications
You must be signed in to change notification settings - Fork 11
45 lines (39 loc) · 1.25 KB
/
update_post_dates.yml
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
42
43
44
45
name: Update post dates
on:
push:
branches:
- 'main'
jobs:
Update-post-dates:
runs-on: ubuntu-latest
container:
image: "rocker/tidyverse:4.2.1"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main # replace with the branch you want to checkout
- name: Run update_post_dates
run: Rscript R/update_post_dates.R # running the R script with Rscript
- name: Configure Git safe directory
run: git config --global --add safe.directory /__w/blog/blog
- name: Check for changes
id: check_changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
if [[ `git status --porcelain` ]]; then
echo "changes detected"
echo "changes=true" >> $GITHUB_ENV
else
echo "no changes"
echo "changes=false" >> $GITHUB_ENV
fi
- name: Commit results
if: env.changes == 'true'
run: |
git add .
git commit -m "Auto-update blog post date"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}