Create Timestamp File #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Timestamp File | |
| on: | |
| schedule: | |
| - cron: "0 0 * * 1" # 每周一午夜执行 | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| create-timestamp: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Git | |
| run: | | |
| git config --local user.name "github-actions[bot]" | |
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Create timestamp file | |
| run: | | |
| timestamp=$(date +"%Y%m%d_%H%M%S") | |
| mkdir -p timestamps | |
| echo "Timestamp: $(date)" > "timestamps/timestamp_${timestamp}.txt" | |
| - name: Commit and push | |
| run: | | |
| git add . | |
| git commit -m "Add timestamp file $(date +"%Y-%m-%d %H:%M:%S")" | |
| git push |