biome-push-on-main-event #619
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
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 }} |