Skip to content

同步源码

同步源码 #128

Workflow file for this run

name: 同步源码
on:
schedule:
- cron: '0 */6 * * *' # 每6小时运行一次
workflow_dispatch: # 允许手动触发
permissions:
contents: write
actions: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
- name: Add upstream repository
run: |
git remote add upstream ${{ vars.UPSTREAM_REPO }}
- name: Fetch upstream
run: |
git fetch upstream
- name: Update README files
run: |
NOTICE="# 重要通知
开源强化版bolt.new 支持第三方线上及本地几乎所有的API【bolt.diy】
## 视频教程
- 安装教程:https://www.bilibili.com/video/BV1xHCgYDET4/
- 使用教程:https://www.bilibili.com/video/BV1SSCJYpEYm/
- YouTube:https://youtu.be/EIAM20LJods
## 更多资源
更多视频教程请访问:https://github.com/aigem/videos
---
"
# 只检查 README.md 文件
if [ -f "README.md" ] && ! grep -q "开源强化版bolt.new" "README.md"; then
# 创建临时文件并确保正确的顺序
echo "$NOTICE" > temp_readme
cat README.md >> temp_readme
# 使用 cat 直接覆盖原文件
cat temp_readme > README.md
rm temp_readme
echo "Updated README.md"
git add README.md
git commit -m "docs: add notification to README.md"
else
echo "README.md already contains notification or does not exist"
fi
- name: Merge upstream
run: |
git merge upstream/$(git branch --show-current) --no-edit
- name: Remove .tool-versions file
run: |
if [ -f ".tool-versions" ]; then
rm .tool-versions
git add .tool-versions
git commit -m "chore: remove .tool-versions file"
fi
- name: Push changes
run: |
git push origin $(git branch --show-current)