-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): improve codegen actions (#390)
- Loading branch information
Showing
5 changed files
with
104 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Run codegen | ||
description: Run codegen | ||
inputs: | ||
kinds: | ||
description: Which kinds of codegen to run | ||
required: true | ||
default: metadata, rules | ||
version: | ||
description: The version of Biome | ||
required: true | ||
default: "0.0.0" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Rust toolchain | ||
uses: ./.github/actions/setup-rust-toolchain | ||
- name: Codegen | ||
shell: bash | ||
run: | | ||
kinds_input='${{ inputs.kinds }}' | ||
# Split the string into an array based on comma or newline delimiter | ||
IFS=$'\n,' read -r -a kinds_array <<< "$kinds_input" | ||
# Trim whitespace from each element and filter out empty elements | ||
kinds=() | ||
for kind in "${kinds_array[@]}"; do | ||
kind=$(echo "$kind" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$//') | ||
if [ -n "$kind" ]; then | ||
kinds+=("$kind") | ||
fi | ||
done | ||
for kind in "${kinds[@]}"; do | ||
echo "Running codegen for $kind" | ||
cargo run --manifest-path codegen/Cargo.toml "$kind" | ||
done | ||
env: | ||
RUST_LOG: info | ||
RUST_BACKTRACE: "1" | ||
CARGO_INCREMENTAL: "1" | ||
BIOME_VERSION: ${{ inputs.version }} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Run codegen | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
kinds: | ||
description: Which kinds of codegen to run | ||
type: string | ||
required: true | ||
default: metadata, rules | ||
version: | ||
description: The version of Biome | ||
type: string | ||
required: true | ||
default: "0.0.0" | ||
|
||
permissions: | ||
actions: write | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
run-codegen: | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: "run-codegen-${{ github.event_name }}" | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
with: | ||
submodules: true | ||
- name: Run codegen | ||
uses: ./.github/actions/run-codegen | ||
with: | ||
kinds: ${{ inputs.kinds }} | ||
version: ${{ inputs.version }} | ||
- name: Create pull request | ||
id: create-pull-request | ||
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5 | ||
with: | ||
branch: "chore/run-codegen-${{ github.event_name }}" | ||
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | ||
title: "chore(ci): run codegen ${{ inputs.kinds }}" | ||
commit-message: "chore(ci): run codegen ${{ inputs.kinds }}" | ||
body: | | ||
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 }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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