Refactor postinstall script for consistency and readability; update f… #4
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: Format code | |
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4.2.2 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v2.0.1 | |
- name: Install dependencies | |
run: bun install | |
- name: Format code | |
run: bun format | |
- name: Configure git | |
run: | | |
git config --global user.name "NYX Language Bot" | |
git config --global user.email "nyxlangbot@binaryblazer.me" | |
- name: Check for changes | |
id: changes | |
run: | | |
git diff --exit-code || echo "changes" | |
- name: Create Pull Request | |
if: steps.changes.outputs.changes == 'changes' | |
id: create_pull_request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.FORMAT_PAT }} | |
commit-message: "Format code with Prettier" | |
branch: format-changes | |
title: "Format code with Prettier" | |
body: "This PR formats the code with Prettier." | |
labels: "auto-merge" | |
- name: Enable Auto-Merge | |
if: steps.changes.outputs.changes == 'changes' | |
uses: peter-evans/enable-pull-request-automerge@v2 | |
with: | |
token: ${{ secrets.FORMAT_PAT }} | |
pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} |