Update update.yml #5
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: Generate and Commit | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 'lts/*' | |
| - name: Run generate script | |
| run: | | |
| npm i --force | |
| chmod +x ./scripts/generate.sh | |
| ./scripts/generate.sh | |
| - name: Check for changes | |
| id: git-status | |
| run: | | |
| git status --porcelain | |
| echo "::set-output name=changed::$(git status --porcelain | wc -l)" | |
| - name: Commit and push changes | |
| if: steps.git-status.outputs.changed != '0' | |
| run: | | |
| git config --global user.name "GitHub Bot" | |
| git config --global user.email "github-actions@github.com" | |
| git add . | |
| git commit -m "Automated update from GitHub Actions" | |
| git push | |
| env: | |
| GH_TOKEN: ${{ secrets.TOKEN }} |