File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Create Timestamp File
2+
3+ on :
4+ schedule :
5+ - cron : " */5 * * * *" # Run every 5 minutes
6+ workflow_dispatch : # Allow manual trigger
7+
8+ jobs :
9+ create-timestamp :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ contents : write
13+
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v4
17+
18+ - name : Setup Git
19+ run : |
20+ git config --local user.name "github-actions[bot]"
21+ git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
22+
23+ - name : Create timestamp file
24+ run : |
25+ timestamp=$(date +"%Y%m%d_%H%M%S")
26+ mkdir -p timestamps
27+ echo "Timestamp: $(date)" > "timestamps/timestamp_${timestamp}.txt"
28+
29+ - name : Commit and push
30+ run : |
31+ git add .
32+ git commit -m "Add timestamp file $(date +"%Y-%m-%d %H:%M:%S")"
33+ git push
Original file line number Diff line number Diff line change 1+ # Daily Timestamp Creator
2+
3+ This repository contains a GitHub Action that automatically creates timestamped files every 5 minutes.
4+
5+ ## How it works
6+
7+ 1 . A GitHub Action workflow runs every 5 minutes
8+ 2 . It creates a new text file with the current timestamp in the ` timestamps ` directory
9+ 3 . The file is committed and pushed automatically by the GitHub Actions bot
10+
11+ ## Manual trigger
12+
13+ You can also manually trigger the workflow through the Actions tab in the GitHub repository.
14+
15+ ## Files
16+
17+ All timestamp files are stored in the ` timestamps/ ` directory with the format ` timestamp_YYYYMMDD_HHMMSS.txt ` .
You can’t perform that action at this time.
0 commit comments