Files
skills/.github/workflows/markdown-fix.yml
T

66 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 Node.js
uses: actions/setup-node@v5
with:
node-version: "24"
cache: npm
- name: Install dependencies
run: npm ci
- name: Format Markdown
run: npm 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."