Update Transitive Dependencies #10
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
| # This Workflow updates the transitive dependencies of Zettlr by deleting the | |
| # lockfile and re-installing everything. | |
| name: 'Update Transitive Dependencies' | |
| on: | |
| workflow_dispatch: {} | |
| schedule: # Once a month, run the dependency updater | |
| - cron: '0 20 1 * *' | |
| env: | |
| NODE_VERSION: '22' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| update_deps: | |
| name: 'Update dependencies' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone repository (develop branch) | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: 'develop' | |
| fetch-depth: 0 | |
| - name: Setup NodeJS ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| # No cache | |
| - name: Enable Yarn and Clear Cache | |
| # Additionally, this run removes the `enableImmutableInstalls` and | |
| # clears the cache to allow the creation of a new lockfile. | |
| run: | | |
| sudo corepack enable | |
| yarn config set -H enableImmutableInstalls false | |
| yarn cache clean --all | |
| - name: Create new branch `transitive-deps-${{ github.run_id }}` | |
| run: | | |
| git checkout -b transitive-deps-${{ github.run_id }} | |
| - name: Update transitive dependencies | |
| run: | | |
| rm yarn.lock | |
| yarn install | |
| - name: Verify Changes | |
| run: | | |
| yarn lint && yarn test | |
| - name: Commit Changes | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add yarn.lock | |
| git commit -m "chore: Bump transitive dependencies ($(date))" | |
| git push -u origin transitive-deps-${{ github.run_id }} | |
| - name: Open PR | |
| run: | | |
| gh pr create -B develop -H transitive-deps-${{ github.run_id }} --title "chore: Bump transitive dependencies ($(date))" --body "Bumps transitive dependencies of the repository." | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |