70 lines
2.3 KiB
YAML
70 lines
2.3 KiB
YAML
name: Update Submodules
|
|
|
|
on:
|
|
schedule:
|
|
# Run daily at 02:00 UTC (11:00 JST)
|
|
- cron: '0 2 * * *'
|
|
workflow_dispatch:
|
|
inputs:
|
|
module:
|
|
description: 'Specific module to update (leave empty for all)'
|
|
required: false
|
|
type: string
|
|
auto_commit:
|
|
description: 'Auto-commit changes'
|
|
required: false
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
update-submodules:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
# Gitea requires token for submodule access
|
|
token: ${{ secrets.GITEA_TOKEN || github.token }}
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name "gitea-actions[bot]"
|
|
git config --global user.email "gitea-actions[bot]@users.noreply.git.syui.ai"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y zsh
|
|
|
|
- name: Update all submodules (scheduled)
|
|
if: github.event_name == 'schedule'
|
|
run: |
|
|
chmod +x claude/scripts/update-submodules.sh
|
|
claude/scripts/update-submodules.sh --all --auto
|
|
|
|
- name: Update specific module (manual)
|
|
if: github.event_name == 'workflow_dispatch' && inputs.module != ''
|
|
run: |
|
|
chmod +x claude/scripts/update-submodules.sh
|
|
claude/scripts/update-submodules.sh --module=${{ inputs.module }} ${{ inputs.auto_commit && '--auto' || '' }}
|
|
|
|
- name: Update all submodules (manual)
|
|
if: github.event_name == 'workflow_dispatch' && inputs.module == ''
|
|
run: |
|
|
chmod +x claude/scripts/update-submodules.sh
|
|
claude/scripts/update-submodules.sh --all ${{ inputs.auto_commit && '--auto' || '' }}
|
|
|
|
- name: Show update summary
|
|
run: |
|
|
echo "## Submodule Update Summary"
|
|
echo "| Module | Status | Commit |"
|
|
echo "|--------|--------|--------|"
|
|
|
|
git submodule status | while read -r line; do
|
|
commit=$(echo "$line" | awk '{print $1}' | sed 's/^[+-]//')
|
|
module=$(echo "$line" | awk '{print $2}')
|
|
short_commit="${commit:0:8}"
|
|
echo "| $module | ✅ Updated | \`$short_commit\` |"
|
|
done |