Automated Commit #1250
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: Automated Commit | |
| on: | |
| push: | |
| branches: [master] # Ensures the workflow triggers on pushes to master | |
| schedule: | |
| - cron: '0 */8 * * *' # Executes every 8 hours | |
| workflow_dispatch: # Allows manual triggering from the GitHub UI | |
| permissions: | |
| contents: write # Grants permissions to write to the repo | |
| jobs: | |
| update_commit: | |
| runs-on: ubuntu-latest # Specifies the runner | |
| steps: | |
| - name: Setup Debug Information | |
| run: echo "::debug::Triggered by ref = ${{github.ref}}" | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 # Latest version for optimized performance | |
| with: | |
| persist-credentials: true # Ensures credentials are available for subsequent steps | |
| fetch-depth: 0 # Fetches all history for all branches and tags | |
| - name: Update Timestamp File | |
| run: | | |
| export TZ="Asia/Jakarta" # Set timezone to UTC+7 (Jakarta time) | |
| current_time=$(date '+%Y-%m-%d %H:%M:%S') | |
| echo "Updated on $current_time (UTC+7)" > TIMESTAMP.txt | |
| - name: Setup Git Configuration | |
| run: | | |
| git config user.email "ryandakaminari@gmail.com" | |
| git config user.name "Ryanda1106" | |
| - name: Prepare Commit | |
| run: | | |
| export TZ="Asia/Jakarta" # Set timezone to UTC+7 (Jakarta time) | |
| current_time=$(date '+%Y-%m-%d %H:%M:%S') | |
| commit_message="Update at $current_time (UTC+7)" | |
| git add TIMESTAMP.txt | |
| git commit -m "$commit_message" || echo "No changes to commit." | |
| - name: GitHub Push | |
| uses: ad-m/github-push-action@v0.6.0 | |
| with: | |
| directory: '.' | |
| github_token: ${{ secrets.GITHUB_TOKEN }} |