-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (40 loc) · 2.04 KB
/
Copy pathupdate-biome-schema.yml
File metadata and controls
46 lines (40 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Update Biome schema
on:
pull_request:
types: [opened, synchronize]
jobs:
update-biome-schema:
# Only run when Dependabot opens a biome-specific PR.
# Dependabot branch names for this package look like:
# dependabot/npm_and_yarn/biomejs/biome-2.4.12
if: github.actor == 'dependabot[bot]' && contains(github.head_ref, 'biomejs/biome')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout PR branch
uses: actions/checkout@v7
with:
ref: ${{ github.head_ref }}
# A personal access token is used (rather than the default GITHUB_TOKEN)
# so that the commit pushed below triggers other workflows (e.g. accented.yml).
# Pushes authenticated with the default GITHUB_TOKEN don't trigger workflow runs:
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#triggering-a-workflow-from-a-workflow
# The token is stored as a Dependabot secret (not an Actions secret) because
# workflows triggered by Dependabot can only access secrets scoped to Dependabot.
token: ${{ secrets.PERSONAL_GITHUB_TOKEN_DEPENDABOT }}
- name: Extract new biome version
id: version
run: |
VERSION=$(node -e "const {default: pkg} = await import('./package.json', {with: {type: 'json'}}); console.log(pkg.devDependencies['@biomejs/biome'].replace(/[^0-9.]/g, ''))")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Update biome.json schema URL
run: |
sed -i "s|https://biomejs.dev/schemas/[^/]*/schema.json|https://biomejs.dev/schemas/${{ steps.version.outputs.version }}/schema.json|" biome.json
- name: Commit and push if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add biome.json
git commit -m "Update biome.json schema to ${{ steps.version.outputs.version }}"
git push