Skip to content

Update Submodule

Update Submodule #525

Workflow file for this run

name: Update Submodule
on:
# 手動実行
workflow_dispatch:
# 定期実行
schedule:
# UTCで実行されているのでJST AM1時30分過ぎに実行される
- cron: "30 16 * * *"
env:
IS_ORIGINAL_REPO: ${{ github.repository == 'code4fukui/fukui-kanko-people-flow-visualization' }}
jobs:
if-original-repo:
runs-on: ubuntu-latest
outputs:
continue: ${{ steps.check.outputs.continue }}
steps:
- id: check
run: |
if [ "${{ env.IS_ORIGINAL_REPO }}" = "true" ]; then
echo "continue=true" >> $GITHUB_OUTPUT
else
echo "continue=false" >> $GITHUB_OUTPUT
fi
# サブモジュールの更新
update:
name: Update Submodules
runs-on: ubuntu-latest
needs:
- if-original-repo
if: needs.if-original-repo.outputs.continue == 'true'
env:
TZ: "Asia/Tokyo"
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.WORKFLOW_TOKEN }}
- name: Update submodules
run: |
git submodule update --remote --init --force --depth 1 --recursive
cp -R data/people-flow-data/full/* packages/whole/public
git diff
git add .
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
if [ $(git status -s | wc -l) -eq 0 ]; then
echo "already updated."
else
git commit -m "🤖 Update submodules at $(date "+DATE: %Y-%m-%d TIME: %H:%M:%S")"
fi
- name: Push changes
run: |
git pull --rebase
git push origin main