Skip to content

Sync and Regenerate PluginMaster #93

Sync and Regenerate PluginMaster

Sync and Regenerate PluginMaster #93

Workflow file for this run

name: Sync and Regenerate PluginMaster
permissions:
contents: write
on:
schedule:
# 每12小时触发一次 (UTC)
- cron: '0 */12 * * *'
workflow_dispatch:
concurrency: regenerate
jobs:
sync-and-generate:
name: Sync and Regenerate
runs-on: windows-latest
steps:
# 1. 检出代码
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
# 2. 配置 Git
- name: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# 3. 同步上游并判断是否有更新
- name: Sync with Upstream
id: sync
shell: bash
run: |
git remote add upstream https://github.com/goatcorp/PluginDistD17.git
git fetch upstream
BEFORE_SHA=$(git rev-parse HEAD)
echo "Attempting to merge upstream..."
git merge upstream/main --allow-unrelated-histories --no-edit
AFTER_SHA=$(git rev-parse HEAD)
if [ "$BEFORE_SHA" == "$AFTER_SHA" ]; then
echo "No changes from upstream. Local is up-to-date."
echo "updated=false" >> $GITHUB_OUTPUT
else
echo "Successfully merged upstream changes."
echo "updated=true" >> $GITHUB_OUTPUT
fi
# 4. 运行生成脚本
- name: Run generator
if: github.event_name == 'workflow_dispatch' || steps.sync.outputs.updated == 'true'
run: .\Make-PluginMaster.ps1
# 5. 提交并推送
- name: Commit and Push
if: github.event_name == 'workflow_dispatch' || steps.sync.outputs.updated == 'true'
shell: bash
run: |
git add -A
if git diff-index --quiet HEAD; then
echo "Generator ran but produced no changes."
exit 0
fi
git commit -m "Regenerate PluginMaster after upstream sync"
git push origin main