Skip to content

Commit

Permalink
chore(ci): synchronize (biomejs#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sec-ant authored Jun 7, 2024
1 parent a8f6eed commit 931d069
Show file tree
Hide file tree
Showing 22 changed files with 236 additions and 407 deletions.
7 changes: 1 addition & 6 deletions .github/actions/run-codegen/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ inputs:
description: The version of Biome
required: true
default: "0.0.0"
revision:
description: The commit ID of the latest revision
required: true

runs:
using: composite
steps:
- name: Setup Rust toolchain
uses: ./.github/actions/setup-rust-toolchain

- name: Codegen
shell: bash
run: |
Expand All @@ -35,9 +33,6 @@ runs:
fi
done
echo "Update cargo to use biome packages for revision ${{ inputs.revision }}"
awk -v new_rev="${{ inputs.revision }}" '{gsub(/rev = "[^"]+"/, "rev = \"" new_rev "\"")} 1' Cargo.toml > temp && mv temp Cargo.toml
for kind in "${kinds[@]}"; do
echo "Running codegen for $kind"
cargo run -p codegen "$kind"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Setup Biome
uses: biomejs/setup-biome@1cbe33ead22c7a2fded3b52fa2893611c815c9b5 # v2.2.1
- name: Run Biome
run: biome ci --reporter=github .
run: biome ci --reporter=github .
4 changes: 2 additions & 2 deletions .github/workflows/label-issue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
permissions:
issues: write
contents: read

jobs:
label-issues:
name: Label issue
Expand All @@ -19,4 +19,4 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/issue-labeler.yaml
enable-versioned-regex: 0
sync-labels: 1
sync-labels: 1
2 changes: 1 addition & 1 deletion .github/workflows/label-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
configuration-path: .github/pull-request-labeler.yaml
configuration-path: .github/pull-request-labeler.yaml
98 changes: 0 additions & 98 deletions .github/workflows/pin-submodule-and-run-codegen.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/run-codegen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ jobs:
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
submodules: true

- name: Run codegen
uses: ./.github/actions/run-codegen
with:
kinds: ${{ inputs.kinds }}
version: ${{ inputs.version }}
revision: ${{ github.event.inputs.commit-id }}

- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
Expand All @@ -47,6 +49,7 @@ jobs:
Run codegen ${{ inputs.kinds }}.
`BIOME_VERSION=${{ inputs.version }}`
labels: CI-Codegen

- 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 }}
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/synchronize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- 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: Install pnpm
run: corepack enable

- name: Setup node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
cache: pnpm

- 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@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
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 }}
4 changes: 4 additions & 0 deletions .github/workflows/update-contributors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Setup node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: "*"

- name: Update contributors
run: node scripts/update-contributors.js --token=${{ secrets.GITHUB_TOKEN }}

- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
Expand All @@ -33,6 +36,7 @@ jobs:
commit-message: "chore(ci): update contributors"
body: ""
labels: CI-Contributors

- 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 }}
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

7 changes: 7 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[formatting]
align_entries = true
indent_entries = true
indent_string = " "
indent_tables = true
reorder_arrays = true
reorder_keys = true
Loading

0 comments on commit 931d069

Please sign in to comment.