Skip to content

Commit 2c89f12

Browse files
committed
Merge branch 'v2' of github.com:CherryHQ/cherry-studio into v2-input
2 parents f7f689b + a3062d6 commit 2c89f12

File tree

457 files changed

+25443
-18062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

457 files changed

+25443
-18062
lines changed

.github/workflows/auto-i18n.yml

Lines changed: 58 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Auto I18N
1+
name: Auto I18N Weekly
22

33
env:
44
TRANSLATION_API_KEY: ${{ secrets.TRANSLATE_API_KEY }}
@@ -7,14 +7,15 @@ env:
77
TRANSLATION_BASE_LOCALE: ${{ vars.AUTO_I18N_BASE_LOCALE || 'en-us'}}
88

99
on:
10-
pull_request:
11-
types: [opened, synchronize, reopened]
10+
schedule:
11+
# Runs at 00:00 UTC every Sunday.
12+
# This corresponds to 08:00 AM UTC+8 (Beijing time) every Sunday.
13+
- cron: "0 0 * * 0"
1214
workflow_dispatch:
1315

1416
jobs:
1517
auto-i18n:
1618
runs-on: ubuntu-latest
17-
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == 'CherryHQ/cherry-studio'
1819
name: Auto I18N
1920
permissions:
2021
contents: write
@@ -24,45 +25,69 @@ jobs:
2425
- name: 🐈‍⬛ Checkout
2526
uses: actions/checkout@v5
2627
with:
27-
ref: ${{ github.event.pull_request.head.ref }}
28+
fetch-depth: 0
2829

2930
- name: 📦 Setting Node.js
30-
uses: actions/setup-node@v5
31+
uses: actions/setup-node@v6
3132
with:
32-
node-version: 20
33-
package-manager-cache: false
33+
node-version: 22
3434

35-
- name: 📦 Install dependencies in isolated directory
36-
run: |
37-
# 在临时目录安装依赖
38-
mkdir -p /tmp/translation-deps
39-
cd /tmp/translation-deps
40-
echo '{"dependencies": {"@cherrystudio/openai": "^6.5.0", "cli-progress": "^3.12.0", "tsx": "^4.20.3", "@biomejs/biome": "2.2.4"}}' > package.json
41-
npm install --no-package-lock
35+
- name: 📦 Install corepack
36+
run: corepack enable && corepack prepare [email protected] --activate
37+
38+
- name: 📂 Get yarn cache directory path
39+
id: yarn-cache-dir-path
40+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
4241

43-
# 设置 NODE_PATH 让项目能找到这些依赖
44-
echo "NODE_PATH=/tmp/translation-deps/node_modules" >> $GITHUB_ENV
42+
- name: 💾 Cache yarn dependencies
43+
uses: actions/cache@v4
44+
with:
45+
path: |
46+
${{ steps.yarn-cache-dir-path.outputs.dir }}
47+
node_modules
48+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
49+
restore-keys: |
50+
${{ runner.os }}-yarn-
51+
52+
- name: 📦 Install dependencies
53+
run: |
54+
yarn install
4555
4656
- name: 🏃‍♀️ Translate
47-
run: npx tsx scripts/sync-i18n.ts && npx tsx scripts/auto-translate-i18n.ts
57+
run: yarn sync:i18n && yarn auto:i18n
4858

4959
- name: 🔍 Format
50-
run: cd /tmp/translation-deps && npx biome format --config-path /home/runner/work/cherry-studio/cherry-studio/biome.jsonc --write /home/runner/work/cherry-studio/cherry-studio/src/renderer/src/i18n/
60+
run: yarn format
5161

52-
- name: 🔄 Commit changes
62+
- name: 🔍 Check for changes
63+
id: git_status
5364
run: |
54-
git config --local user.email "[email protected]"
55-
git config --local user.name "GitHub Action"
56-
git add .
65+
# Check if there are any uncommitted changes
5766
git reset -- package.json yarn.lock # 不提交 package.json 和 yarn.lock 的更改
58-
if git diff --cached --quiet; then
59-
echo "No changes to commit"
60-
else
61-
git commit -m "fix(i18n): Auto update translations for PR #${{ github.event.pull_request.number }}"
62-
fi
63-
64-
- name: 🚀 Push changes
65-
uses: ad-m/github-push-action@master
67+
git diff --exit-code --quiet || echo "::set-output name=has_changes::true"
68+
git status --porcelain
69+
70+
- name: 📅 Set current date for PR title
71+
id: set_date
72+
run: echo "CURRENT_DATE=$(date +'%b %d, %Y')" >> $GITHUB_ENV # e.g., "Jun 06, 2024"
73+
74+
- name: 🚀 Create Pull Request if changes exist
75+
if: steps.git_status.outputs.has_changes == 'true'
76+
uses: peter-evans/create-pull-request@v6
6677
with:
67-
github_token: ${{ secrets.GITHUB_TOKEN }}
68-
branch: ${{ github.event.pull_request.head.ref }}
78+
token: ${{ secrets.GITHUB_TOKEN }} # Use the built-in GITHUB_TOKEN for bot actions
79+
commit-message: "feat(bot): Weekly automated script run"
80+
title: "🤖 Weekly Automated Update: ${{ env.CURRENT_DATE }}"
81+
body: |
82+
This PR includes changes generated by the weekly auto i18n.
83+
Review the changes before merging.
84+
85+
---
86+
_Generated by the automated weekly workflow_
87+
branch: "auto-i18n-weekly-${{ github.run_id }}" # Unique branch name
88+
base: "main" # Or 'develop', set your base branch
89+
delete-branch: true # Delete the branch after merging or closing the PR
90+
91+
- name: 📢 Notify if no changes
92+
if: steps.git_status.outputs.has_changes != 'true'
93+
run: echo "Bot script ran, but no changes were detected. No PR created."

.github/workflows/github-issue-tracker.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [opened]
66
schedule:
77
# Run every day at 8:30 Beijing Time (00:30 UTC)
8-
- cron: '30 0 * * *'
8+
- cron: "30 0 * * *"
99
workflow_dispatch:
1010

1111
jobs:
@@ -54,9 +54,9 @@ jobs:
5454
5555
- name: Setup Node.js
5656
if: steps.check_time.outputs.should_delay == 'false'
57-
uses: actions/setup-node@v4
57+
uses: actions/setup-node@v6
5858
with:
59-
node-version: '20'
59+
node-version: 22
6060

6161
- name: Process issue with Claude
6262
if: steps.check_time.outputs.should_delay == 'false'
@@ -121,9 +121,9 @@ jobs:
121121
uses: actions/checkout@v4
122122

123123
- name: Setup Node.js
124-
uses: actions/setup-node@v4
124+
uses: actions/setup-node@v6
125125
with:
126-
node-version: '20'
126+
node-version: 22
127127

128128
- name: Process pending issues with Claude
129129
uses: anthropics/claude-code-action@main

.github/workflows/issue-management.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
contents: none
2222
steps:
2323
- name: Close needs-more-info issues
24-
uses: actions/stale@v9
24+
uses: actions/stale@v10
2525
with:
2626
repo-token: ${{ secrets.GITHUB_TOKEN }}
2727
only-labels: 'needs-more-info'
@@ -42,7 +42,7 @@ jobs:
4242
days-before-pr-close: -1
4343

4444
- name: Close inactive issues
45-
uses: actions/stale@v9
45+
uses: actions/stale@v10
4646
with:
4747
repo-token: ${{ secrets.GITHUB_TOKEN }}
4848
days-before-stale: ${{ env.daysBeforeStale }}

.github/workflows/nightly-build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Nightly Build
33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: '0 17 * * *' # 1:00 BJ Time
6+
- cron: "0 17 * * *" # 1:00 BJ Time
77

88
permissions:
99
contents: write
@@ -56,17 +56,17 @@ jobs:
5656
ref: main
5757

5858
- name: Install Node.js
59-
uses: actions/setup-node@v5
59+
uses: actions/setup-node@v6
6060
with:
61-
node-version: 20
61+
node-version: 22
6262

6363
- name: macos-latest dependencies fix
6464
if: matrix.os == 'macos-latest'
6565
run: |
6666
brew install python-setuptools
6767
6868
- name: Install corepack
69-
run: corepack enable && corepack prepare yarn@4.6.0 --activate
69+
run: corepack enable && corepack prepare yarn@4.9.1 --activate
7070

7171
- name: Get yarn cache directory path
7272
id: yarn-cache-dir-path
@@ -208,7 +208,7 @@ jobs:
208208
echo "总计: $(find renamed-artifacts -type f | wc -l) 个文件"
209209
210210
- name: Upload artifacts
211-
uses: actions/upload-artifact@v4
211+
uses: actions/upload-artifact@v5
212212
with:
213213
name: cherry-studio-nightly-${{ steps.date.outputs.date }}-${{ matrix.os }}
214214
path: renamed-artifacts/*

.github/workflows/pr-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ jobs:
2424
uses: actions/checkout@v5
2525

2626
- name: Install Node.js
27-
uses: actions/setup-node@v5
27+
uses: actions/setup-node@v6
2828
with:
29-
node-version: 20
29+
node-version: 22
3030

3131
- name: Install corepack
32-
run: corepack enable && corepack prepare yarn@4.6.0 --activate
32+
run: corepack enable && corepack prepare yarn@4.9.1 --activate
3333

3434
- name: Get yarn cache directory path
3535
id: yarn-cache-dir-path

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
tag:
7-
description: 'Release tag (e.g. v1.0.0)'
7+
description: "Release tag (e.g. v1.0.0)"
88
required: true
9-
default: 'v1.0.0'
9+
default: "v1.0.0"
1010
push:
1111
tags:
1212
- v*.*.*
@@ -47,17 +47,17 @@ jobs:
4747
npm version "$VERSION" --no-git-tag-version --allow-same-version
4848
4949
- name: Install Node.js
50-
uses: actions/setup-node@v5
50+
uses: actions/setup-node@v6
5151
with:
52-
node-version: 20
52+
node-version: 22
5353

5454
- name: macos-latest dependencies fix
5555
if: matrix.os == 'macos-latest'
5656
run: |
5757
brew install python-setuptools
5858
5959
- name: Install corepack
60-
run: corepack enable && corepack prepare yarn@4.6.0 --activate
60+
run: corepack enable && corepack prepare yarn@4.9.1 --activate
6161

6262
- name: Get yarn cache directory path
6363
id: yarn-cache-dir-path
@@ -127,5 +127,5 @@ jobs:
127127
allowUpdates: true
128128
makeLatest: false
129129
tag: ${{ steps.get-tag.outputs.tag }}
130-
artifacts: 'dist/*.exe,dist/*.zip,dist/*.dmg,dist/*.AppImage,dist/*.snap,dist/*.deb,dist/*.rpm,dist/*.tar.gz,dist/latest*.yml,dist/rc*.yml,dist/beta*.yml,dist/*.blockmap'
130+
artifacts: "dist/*.exe,dist/*.zip,dist/*.dmg,dist/*.AppImage,dist/*.snap,dist/*.deb,dist/*.rpm,dist/*.tar.gz,dist/latest*.yml,dist/rc*.yml,dist/beta*.yml,dist/*.blockmap"
131131
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)