Sync #645
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| name: | |
| description: 'Git Message' | |
| required: false | |
| default: 'Self Commit' | |
| jobs: | |
| sync: | |
| name: 'Submodules Sync' | |
| runs-on: ubuntu-latest | |
| # Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| # Checkout the repository to the GitHub Actions runner | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| # Default: ${{ github.token }} ,传参给它更高权限的 token | |
| token: ${{ secrets.PERSONAL_TOKEN }} | |
| submodules: true | |
| # Update references | |
| - name: Pull & update submodules recursively | |
| run: | | |
| git submodule update --init --recursive | |
| git submodule update --recursive --remote | |
| - name: Commit update | |
| run: | | |
| git config --global user.name 'Git bot' | |
| git config --global user.email 'bot@noreply.github.com' | |
| git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
| git commit -am "Submodule: ${{github.event.inputs.name}}" && git push || echo "No changes to commit" |