Sync #84
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@v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Update submodule | |
| run: git submodule update --remote | |
| - name: Check status | |
| id: check | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "update=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "update=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit changes | |
| 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 ejs | |
| git commit -m "chore(main): 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@v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v5 | |
| - name: Sync dependencies | |
| run: npm run sync:deps | |
| - name: Commit changes | |
| 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 package.json | |
| git commit -m "chore(deps): sync with ejs" | |
| git push origin main | |
| else | |
| exit 0 | |
| fi |