-
Notifications
You must be signed in to change notification settings - Fork 0
/
monthly-timestamp-update.yml
44 lines (38 loc) · 1.32 KB
/
monthly-timestamp-update.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
name: Monthly Timestamp Update
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *'
jobs:
check-and-update-timestamp:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Git identity
run: |
git config --global user.name 'github-actions-bot'
git config --global user.email '[email protected]'
- name: Check for GithubActionTimeStamp branch
run: |
if git branch --list GithubActionTimeStamp; then
echo "GithubActionTimeStamp branch already exists."
else
echo "Creating GithubActionTimeStamp branch."
git checkout --orphan GithubActionTimeStamp
git rm -rf .
touch .gitkeep
git add .gitkeep
git commit -m "Initial commit on GithubActionTimeStamp branch"
git push origin GithubActionTimeStamp
fi
- name: Update timestamp
run: |
git fetch --all
git checkout GithubActionTimeStamp || git checkout -b GithubActionTimeStamp
date +'%Y-%m-%d %H:%M:%S' > timestamp.txt
git add timestamp.txt
git commit -m "Update timestamp"
git push origin GithubActionTimeStamp