-
-
Notifications
You must be signed in to change notification settings - Fork 76
78 lines (64 loc) · 2.86 KB
/
synchronize.yaml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Synchronize
on:
workflow_dispatch:
inputs:
commit-id:
description: Commit ID of biomejs/biome
required: true
type: string
repository_dispatch:
types: [ biome-push-on-main-event ]
permissions:
actions: write
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
synchronize:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Get commit ID (workflow dispatch, empty)
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit-id == '' }}
run: echo "You must provide a full commit ID." && exit 1
- name: Get commit ID (workflow dispatch, non-empty)
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit-id != '' }}
run: echo "COMMIT_ID=${{ github.event.inputs.commit-id }}" >> $GITHUB_ENV
- name: Get commit ID (repository dispatch)
if: ${{ github.event_name == 'repository_dispatch'}}
run: echo "COMMIT_ID=${{ github.event.client_payload.event.head_commit.id }}" >> "$GITHUB_ENV"
- name: Get short commit ID
run: echo "SHORT_COMMIT_ID=$(echo ${{ env.COMMIT_ID }} | cut -c 1-7)" >> "$GITHUB_ENV"
- name: Free Disk Space
uses: ./.github/actions/free-disk-space
- name: Install pnpm
run: corepack enable
- name: Setup node
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version-file: ".node-version"
- name: Update revision
run: ./scripts/update-revision.sh '${{ env.COMMIT_ID }}'
- name: Run codegen
uses: ./.github/actions/run-codegen
with:
kinds: metadata, rules
version: "0.0.0"
- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
branch: "chore/synchronize-${{ github.event_name }}"
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
title: "chore(ci): synchronize to `${{ env.SHORT_COMMIT_ID }}`"
commit-message: "chore(ci): synchronize to `${{ env.SHORT_COMMIT_ID }}`"
body: "Synchronize to [`${{ env.SHORT_COMMIT_ID }}`](https://github.com/biomejs/biome/commit/${{ env.COMMIT_ID }})."
labels: CI-Synchronize
- name: Auto merge
if: ${{ steps.create-pull-request.outputs.pull-request-operation != 'closed' && steps.create-pull-request.outputs.pull-request-number != '' }}
run: gh pr merge --squash --auto --delete-branch ${{ steps.create-pull-request.outputs.pull-request-number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}