-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (76 loc) · 2.39 KB
/
update-plugin-info.yml
File metadata and controls
91 lines (76 loc) · 2.39 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: 更新插件信息
on:
push:
branches: [main]
paths:
- 'plugins.v4.json'
pull_request_target:
types: [closed]
branches:
- main
paths:
- 'plugins.v4.json'
permissions:
contents: write
concurrency:
group: update-plugin-info
cancel-in-progress: true
jobs:
update-on-merge:
name: PR合并后更新
runs-on: ubuntu-latest
if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: 更新下载量
run: node scripts/update-download-count.mjs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 更新本次变更插件的 updateTime
run: node scripts/update-plugin-time-on-merge.mjs
env:
BASE_REF: HEAD~1
CURRENT_REF: HEAD
- name: 更新索引 updateTime
run: node scripts/update-index-time.mjs
- name: 提交更改
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add plugins.v4.json
git diff --quiet && exit 0 || git commit -m "chore: 更新插件信息"
git push
update-on-push:
name: Push后更新索引时间
runs-on: ubuntu-latest
if: github.event_name == 'push' && !contains(github.event.head_commit.message, 'chore: 更新插件信息') && !contains(github.event.head_commit.message, 'chore: update index timestamp')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: 更新索引 updateTime
run: node scripts/update-index-time.mjs
- name: Commit and push if changed
run: |
if git diff --quiet; then
echo "No updateTime change."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add plugins.v4.json
git commit -m "chore: update index timestamp"
git push