Skip to content

Commit 406028d

Browse files
committed
chore: Add CI job to update dependencies
1 parent a5cda56 commit 406028d

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/deno-lock.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Update dependencies
2+
3+
on:
4+
push:
5+
branches:
6+
- ci/update-deps
7+
schedule:
8+
- cron: "15 15 1-7,15-21 * 1"
9+
- cron: "15 16 1-7 * 2"
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
update:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
steps:
22+
- name: Checkout pull request
23+
uses: actions/checkout@v5
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
- uses: denoland/setup-deno@v2
27+
with:
28+
deno-version: v2.x
29+
- name: Dump GitHub context
30+
env:
31+
GITHUB_CONTEXT: ${{ toJson(github) }}
32+
run: echo "$GITHUB_CONTEXT"
33+
34+
- name: Set compatible update
35+
if: github.event.schedule != '15 16 1-7 * 2'
36+
run: echo UPDATE_TYPE=compatible >> $GITHUB_ENV
37+
- name: Set latest update
38+
if: github.event.schedule == '15 16 1-7 * 2'
39+
run: echo UPDATE_TYPE=latest >> $GITHUB_ENV
40+
- name: Set git identity
41+
run: |
42+
git config --global user.name "bids[bot]"
43+
git config --global user.email "[email protected]"
44+
- name: Install the latest version of uv
45+
uses: astral-sh/setup-uv@v7
46+
- name: List updates
47+
run: >
48+
deno outdated |
49+
perl -0 -pe 's/[^[:ascii:]]//g; s/\n\n/\n/g; s/(^|\n) */$1/g' |
50+
uvx tabulate -f github -1 - |
51+
tee /tmp/outdated.md
52+
- name: Update dependencies
53+
run: >
54+
uvx datalad run -i deno.json -i deno.lock -o deno.json -o deno.lock --
55+
bash -c
56+
"deno update --$UPDATE_TYPE @bids/schema &&
57+
deno update --$UPDATE_TYPE --minimum-dependency-age $MIN_AGE"
58+
env:
59+
# Two weeks, in minutes
60+
MIN_AGE: 20160
61+
- name: Check for changes
62+
id: check
63+
run: |
64+
if [[ "$REF" != "$( git rev-parse HEAD )" ]]; then
65+
echo "changes=1" >> $GITHUB_OUTPUT
66+
fi
67+
env:
68+
REF: ${{ github.sha }}
69+
- name: Make pull request
70+
if: steps.check.outputs.changes
71+
uses: peter-evans/create-pull-request@v7
72+
with:
73+
branch: deps/${{ env.UPDATE_TYPE }}
74+
title: "chore(deps): Update strategy ${{ env.UPDATE_TYPE }}"
75+
body-path: /tmp/outdate.md

0 commit comments

Comments
 (0)