forked from ChinaGodMan/UserScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 1.45 KB
/
Copy pathformat-userscripts.yml
File metadata and controls
42 lines (34 loc) · 1.45 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
name: format-userscripts
on:
# schedule:
# - cron: "0 2 * * 2" # 每周二的 UTC 时间 2 点,即北京时间的早上 10 点
workflow_dispatch: # 允许手动触发工作流
jobs:
format-js:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository from bak branch
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.MY_GITHUB_TOKEN }}
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16" # 可以根据需要调整
# Step 3: Run the custom formatting script (1.js)
- name: Run format script
run: node utils/format-monkey-meta.js
# Step 4: Commit and push changes back to the bak branch (if any)
- name:
Commit and push changes
# 在推送时使用 GitHub Token
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Auto-format UserScripts" || echo "No changes to commit"
git push
env:
MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}