Sync #38
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: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| concurrency: | |
| group: sync | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| commit: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| update: ${{ steps.check.outputs.update }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Update submodule | |
| run: npm run sync:mods | |
| - name: Check update | |
| id: check | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "update=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "update=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit update | |
| if: steps.check.outputs.update == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "chore: sync with ejs" | |
| git push origin main | |
| update: | |
| needs: commit | |
| if: needs.commit.outputs.update == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v5 | |
| - name: Sync deps | |
| run: npm run sync:deps | |
| - name: Commit deps | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "deps: sync with ejs" | |
| git push origin main | |
| else | |
| exit 0 | |
| fi |