generated from 0xmaudy/commit
-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (41 loc) · 1.65 KB
/
master.yml
File metadata and controls
53 lines (41 loc) · 1.65 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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 }}