-
Notifications
You must be signed in to change notification settings - Fork 17
79 lines (68 loc) · 3.05 KB
/
sync_schema_files.yml
File metadata and controls
79 lines (68 loc) · 3.05 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
name: Sync JSON Schema Files from MaaFramework
on:
schedule:
- cron: '10 0 * * *' # UTC 00:10 每天运行
workflow_dispatch:
permissions:
contents: write
pull-requests: write # 必须:允许创建 PR
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
check-repository:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- id: check
run: |
if [[ "${{ github.repository }}" == "sunyink/MFABD2" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "should_run=false" >> $GITHUB_OUTPUT
fi
sync-schema-files:
needs: check-repository
if: needs.check-repository.outputs.should_run == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 在这里列出你需要同步的分支,假设你的开发分支叫 dev
branch: [main, develop]
steps:
- name: Check Out Repository
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }} # 检出对应的目标分支
- name: Download JSON schema files from MaaFramework
run: |
echo "Syncing for branch: ${{ matrix.branch }}"
mkdir -p deps/tools
# 下载文件
curl -s -o deps/tools/interface.schema.json https://raw.githubusercontent.com/MaaXYZ/MaaFramework/main/tools/interface.schema.json
curl -s -o deps/tools/interface_v2.schema.json https://raw.githubusercontent.com/MaaXYZ/MaaFramework/main/tools/interface_v2.schema.json
curl -s -o deps/tools/interface_config.schema.json https://raw.githubusercontent.com/MaaXYZ/MaaFramework/main/tools/interface_config.schema.json
curl -s -o deps/tools/pipeline.schema.json https://raw.githubusercontent.com/MaaXYZ/MaaFramework/main/tools/pipeline.schema.json
echo "Downloaded files."
# 使用 peter-evans/create-pull-request 自动处理变更检测和 PR 创建
# 它会自动对比下载的文件和仓库里的文件,如果没有变化,它什么都不做。
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: chore/update schema files from MaaFramework
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
signoff: false
# PR 的分支名,加上分支后缀以区分
branch: chore/sync-schema-${{ matrix.branch }}
delete-branch: true
# PR 的目标分支
base: ${{ matrix.branch }}
title: 'chore: update schema files from MaaFramework for ${{ matrix.branch }}'
body: |
Sync JSON schema files from MaaFramework.
Target Branch: `${{ matrix.branch }}`
Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
draft: false