chore: Add CI job to update dependencies #1
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: | ||
| branch: | ||
| - ci/update-deps | ||
| schedule: | ||
| - cron: "15 15 1-7,15-21 * 1" | ||
| - cron: "15 16 1-7 * 2" | ||
| workflow_dispatch: | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| update: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout pull request | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - uses: denoland/setup-deno@v2 | ||
| with: | ||
| deno-version: v2.x | ||
| - name: Set compatible update | ||
| if: github.event.schedule != '15 16 1-7 * 2' | ||
| run: echo UPDATE_TYPE=compatible >> $GITHUB_ENV | ||
| - name: Set latest update | ||
| if: github.event.schedule == '15 16 1-7 * 2' | ||
| run: echo UPDATE_TYPE=latest >> $GITHUB_ENV | ||
| - name: Set git identity | ||
| run: | | ||
| git config --global user.name "bids[bot]" | ||
| git config --global user.email "[email protected]" | ||
| - name: Install the latest version of uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| - name: Update all dependencies with 14 day cooldown | ||
| run: > | ||
| uvx datalad run -i deno.json -i deno.lock -o deno.json -o deno.lock -- | ||
| deno update --$UPDATE_TYPE --minimum-dependency-age $MIN_AGE | ||
| env: | ||
| # Two weeks, in minutes | ||
| MIN_AGE: 20160 | ||
| - name: Update @bids/schema | ||
| run: > | ||
| uvx datalad run -i deno.json -i deno.lock -o deno.json -o deno.lock -- | ||
| deno update --$UPDATE_TYPE @bids/schema | ||
| - name: Check for changes | ||
| id: check | ||
| run: | | ||
| if [[ "$REF" != "$( git rev-parse HEAD )" ]]; then | ||
| echo "changes=1" >> $GITHUB_OUTPUT | ||
| fi | ||
| env: | ||
| REF: ${{ github.event.pull_request.head.sha }} | ||
| - name: Push updated branch, if needed | ||
| if: steps.check.changes | ||
| run: git push -f origin HEAD:deps/$UPDATE_TYPE | ||