Skip to content

Submoduleの更新確認 #92

Submoduleの更新確認

Submoduleの更新確認 #92

name: Submoduleの更新確認
on:
schedule:
- cron: '0 3 * * 1'
workflow_dispatch:
jobs:
check-submodule:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
submodules: recursive
persist-credentials: false
- run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git switch -c update-submodule
- run: git submodule update --remote
- id: submodule-diff
run: |
if [[ $(git diff --name-only) != "" ]]; then
git add binding/voicevox_core
git commit -m "Update submodule"
echo submodule_has_update="true" >> $GITHUB_OUTPUT;
fi
- if: ${{ steps.submodule-diff.outputs.submodule_has_update == 'true'}}
uses: actions-rust-lang/[email protected]
- if: ${{ steps.submodule-diff.outputs.submodule_has_update == 'true'}}
working-directory: ./binding
run: make generate
- if: ${{ steps.submodule-diff.outputs.submodule_has_update == 'true'}}
id: binding-diff
run: if [[ $(git diff --name-only | grep .cs$) != "" ]]; then echo binding_has_update="true" >> $GITHUB_OUTPUT; fi
- if: ${{ steps.binding-diff.outputs.binding_has_update == 'true'}}
run: exit 1 # .csファイルの更新が必要になるため、失敗させる
- if: ${{ steps.submodule-diff.outputs.submodule_has_update == 'true'}}
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
git add src/VoicevoxCoreSharp.Core
git commit -m "make generate"
git remote show origin
git config --global url."https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com".insteadOf "https://github.com"
git push origin HEAD
gh pr create --title "Update submodule" --body "Update submodule" --base main --head update-submodule