Python Script (Linked to Account) #1270
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: Python Script (Linked to Account) | |
| on: | |
| schedule: | |
| - cron: "*/23 * * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-timestamp: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1️⃣ Checkout the repository | |
| - uses: actions/checkout@v3 | |
| # 2️⃣ Update the timestamp file | |
| - name: Update timestamp | |
| run: | | |
| TIMESTAMP_FILE="updates.txt" | |
| # Overwrite the file with current UTC time (ISO 8601) | |
| echo "Last checked: $(date -u +"%Y-%m-%dT%H:%M:%SZ")" > "$TIMESTAMP_FILE" | |
| # Configure Git | |
| git config user.name "mwakidenis" | |
| git config user.email "mwakidenice@gmail.com" | |
| # Stage changes | |
| git add "$TIMESTAMP_FILE" | |
| # Commit only if there are changes; amend last commit if needed | |
| if ! git diff --cached --quiet; then | |
| git commit -m "Update timestamp: $(date -u)" | |
| else | |
| echo "No changes to commit" | |
| fi | |
| # 3️⃣ Push changes | |
| - name: Push changes | |
| run: git push origin HEAD |