65 lines
1.6 KiB
YAML
65 lines
1.6 KiB
YAML
name: Markdown Fix
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
commit_message:
|
|
description: Commit message for Markdown formatting changes
|
|
required: true
|
|
default: "style: format markdown"
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
prettier:
|
|
name: Format and commit Markdown
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
concurrency:
|
|
group: markdown-fix-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: "1.3.11"
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Format Markdown
|
|
run: bun run format:md
|
|
|
|
- name: Detect changes
|
|
id: changes
|
|
shell: bash
|
|
run: |
|
|
if git diff --quiet; then
|
|
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Commit formatting changes
|
|
if: steps.changes.outputs.changed == 'true'
|
|
shell: bash
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add --all -- '*.md'
|
|
git commit -m "${{ inputs.commit_message }}"
|
|
|
|
- name: Push formatting changes
|
|
if: steps.changes.outputs.changed == 'true'
|
|
run: git push
|
|
|
|
- name: No changes
|
|
if: steps.changes.outputs.changed != 'true'
|
|
run: echo "Markdown files are already formatted."
|