Skip to content

Commit 10bbfe2

Browse files
authored
validate mrk pipeline
1 parent 24e3865 commit 10bbfe2

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Validate and Fix Markdown
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
validate-and-fix-markdown:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
ref: ${{ github.head_ref || github.ref_name }}
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: '16'
27+
28+
- name: Install Markdown Linter
29+
run: npm install -g markdownlint-cli
30+
31+
- name: Lint and Fix Markdown files
32+
run: markdownlint '**/*.md' --fix --config .github/.markdownlint.json
33+
34+
- name: Configure Git
35+
run: |
36+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
37+
git config --global user.name "github-actions[bot]"
38+
39+
- name: Commit and merge changes
40+
env:
41+
PR_BRANCH: ${{ github.head_ref || github.ref_name }}
42+
GIT_AUTHOR_NAME: github-actions[bot]
43+
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
44+
GIT_COMMITTER_NAME: github-actions[bot]
45+
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
46+
run: |
47+
# Ensure we're on the correct branch
48+
git switch -c "$PR_BRANCH" || git switch "$PR_BRANCH"
49+
50+
# Stage and commit changes if any
51+
git add -A
52+
git diff --staged --quiet || git commit -m "Fix Markdown syntax issues"
53+
54+
# Pull and merge existing changes
55+
git pull origin "$PR_BRANCH" --no-rebase
56+
57+
# Push all changes
58+
git push origin "$PR_BRANCH"

0 commit comments

Comments
 (0)