Skip to content

Commit 91e426a

Browse files
Create master.yml
1 parent b42864b commit 91e426a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/master.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Automated Commit
2+
3+
on:
4+
push:
5+
branches: [master] # Ensures the workflow triggers on pushes to master
6+
7+
schedule:
8+
- cron: '0 */12 * * *' # Executes every 12 hours
9+
10+
workflow_dispatch: # Allows manual triggering from the GitHub UI
11+
12+
permissions:
13+
contents: write # Grants permissions to write to the repo
14+
15+
jobs:
16+
update_commit:
17+
runs-on: ubuntu-latest # Specifies the runner
18+
19+
steps:
20+
- name: Setup Debug Information
21+
run: echo "::debug::Triggered by ref = ${{github.ref}}"
22+
23+
- name: Checkout Code
24+
uses: actions/checkout@v3 # Latest version for optimized performance
25+
with:
26+
persist-credentials: true # Ensures credentials are available for subsequent steps
27+
fetch-depth: 0 # Fetches all history for all branches and tags
28+
29+
- name: Update Timestamp File
30+
run: |
31+
current_time=$(date '+%Y-%m-%d %H:%M:%S')
32+
echo "Updated on $current_time" > TIMESTAMP.txt
33+
34+
- name: Setup Git Configuration
35+
run: |
36+
git config user.email "${{ vars.GIT_USER_EMAIL || 'github-actions[bot]@users.noreply.github.com' }}"
37+
git config user.name "${{ vars.GIT_USER_NAME || 'github-actions[bot]' }}"
38+
39+
- name: Prepare Commit
40+
run: |
41+
commit_messages=("Update: ⏰" "Refresh: 🔄" "Renew: 🌟" "Revise: 📝" "Amend: 🛠" "Adjust: 🔧" "Change: 📈" "Modify: 🖊" "Transform: 🌀" "Revamp: 🌈")
42+
random_msg=${commit_messages[$RANDOM % ${#commit_messages[@]}]}
43+
44+
git add TIMESTAMP.txt
45+
git commit -m "$random_msg - $current_time" || echo "No changes to commit."
46+
47+
- name: GitHub Push
48+
uses: ad-m/[email protected]
49+
with:
50+
directory: '.'
51+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)