Update Dependencies #33
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: Update Dependencies | |
| on: | |
| schedule: | |
| # every Monday at 00:00 UTC | |
| - cron: '0 0 * * 1' | |
| workflow_dispatch: # can be run manually | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-dependencies: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - name: Enable Corepack and setup Yarn | |
| run: | | |
| corepack enable | |
| corepack prepare [email protected] --activate | |
| # Set yarn version to 4.3.1 and ensure it's available | |
| YARN_IGNORE_PATH=1 yarn set version 4.3.1 | |
| # Verify yarn is working | |
| yarn --version | |
| env: | |
| YARN_IGNORE_PATH: 1 | |
| - name: Configure git | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| - name: Create and switch to dependency branch | |
| run: | | |
| git checkout -b dependency-update-$(date +%Y%m%d) | |
| - name: Install dependencies | |
| run: | | |
| yarn install --immutable | |
| env: | |
| YARN_IGNORE_PATH: 1 | |
| - name: Update all dependencies | |
| run: | | |
| yarn up "**" | |
| env: | |
| YARN_IGNORE_PATH: 1 | |
| - name: Install updated dependencies | |
| run: | | |
| yarn install | |
| sudo npx playwright install-deps | |
| npx playwright install | |
| env: | |
| YARN_IGNORE_PATH: 1 | |
| - name: Run tests | |
| run: | | |
| yarn coverage:ci | |
| env: | |
| YARN_IGNORE_PATH: 1 | |
| - name: Check if there are changes | |
| id: check_changes | |
| run: | | |
| if git diff --quiet; then | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit changes | |
| if: steps.check_changes.outputs.changes == 'true' | |
| run: | | |
| git add . | |
| git commit -m "chore(deps-dev): update dependency | |
| update dependencies to the latest" | |
| - name: Push dependency branch | |
| if: steps.check_changes.outputs.changes == 'true' | |
| run: | | |
| git push origin HEAD --force-with-lease | |
| - name: Create Pull Request | |
| if: steps.check_changes.outputs.changes == 'true' | |
| run: | | |
| gh pr create \ | |
| --title "chore(deps-dev): update dependencies" \ | |
| --body "Automated dependency updates to the latest versions. | |
| This PR contains the following changes: | |
| - Updated all dependencies to their latest compatible versions | |
| - All tests are passing | |
| Please review and merge if everything looks good." \ | |
| --base master \ | |
| --head dependency-update-$(date +%Y%m%d) \ | |
| --label "chore,dependencies,dev-env" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: No changes found | |
| if: steps.check_changes.outputs.changes == 'false' | |
| run: | | |
| echo "No dependency updates available" | |
| git checkout master | |
| git branch -D dependency-update-$(date +%Y%m%d) |