-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.1 KB
/
append_time_log.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
name: Append Time to Log
# Run this action every day at midnight UTC
on:
schedule:
- cron: '0 0 * * *'
jobs:
append_time_v2:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure the entire history is fetched
# Step 2: Pull the latest changes from the remote
- name: Pull latest changes
run: |
git pull origin main
# Step 3: Append the current time to the log file
- name: Append current time to log
run: |
echo $(date) >> time_log.txt
# Step 4: Commit and push the changes using GITHUB_TOKEN
- name: Commit and push changes
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add time_log.txt
git commit -m "Updated time log: $(date)" || echo "No changes to commit"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}