Skip to content

Commit

Permalink
[Tool] Add CI Doc Checker (#35200)
Browse files Browse the repository at this point in the history
Signed-off-by: AndyZiYe <[email protected]>
(cherry picked from commit daaa57a)

# Conflicts:
#	.github/workflows/ci-pipeline-branch.yml
  • Loading branch information
andyziye authored and mergify[bot] committed Nov 16, 2023
1 parent 3cb94cf commit d8eb9ef
Show file tree
Hide file tree
Showing 2 changed files with 477 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/ci-doc-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI DOC Checker

on:
pull_request_target:
types:
- opened
- synchronize
branches:
- main
- 'branch*'

permissions:
issues: write
pull-requests: write

jobs:
doc-checker:
runs-on: ubuntu-latest
name: DOC FILTER
if: >
!contains(github.event.pull_request.title, '(sync #') &&
!contains(github.event.pull_request.labels.*.name, 'sync') &&
(!startsWith(github.head_ref, github.base_ref) || !contains(github.head_ref, '-sync-'))
outputs:
output1: ${{ steps.doc-changes-info.outputs.doc }}
steps:
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
doc:
- 'docs/**'
- name: DOC CHECK INFO
id: doc-changes-info
run: |
echo "doc=${{ steps.changes.outputs.doc }}" >> $GITHUB_OUTPUT
add-doc-label:
needs: doc-checker
runs-on: ubuntu-latest
name: ADD DOC LABEL
if: ${{ needs.doc-checker.outputs.output1 == 'true' }}
steps:
- name: add document label
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.PAT }}
labels: documentation

markdownlint:
runs-on: ubuntu-latest
needs: add-doc-label
env:
PR_NUMBER: ${{ github.event.number }}
steps:
- name: clean
run: |
rm -rf ${{ github.workspace }}
mkdir -p ${{ github.workspace }}
- name: BRANCH INFO
id: branch
run: |
echo ${{github.base_ref}}
echo "branch=${{github.base_ref}}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Checkout PR
run: |
BRANCH=${{steps.branch.outputs.branch}}
git config --global user.name "wanpengfei-git";
git config --global user.email "[email protected]";
git checkout $BRANCH;
git pull;
BRANCH_NAME="${BRANCH}-${PR_NUMBER}";
git fetch origin pull/${PR_NUMBER}/head:${BRANCH_NAME};
git checkout $BRANCH_NAME;
git checkout -b merge_pr;
git merge --squash --no-edit ${BRANCH} || (echo "Merge conflict, please check." && exit -1);
- uses: articulate/[email protected]
with:
config: "docs/.markdownlint.yaml"
files: 'docs/**/*.md'
ignore: node_modules
version: 0.28.1
Loading

0 comments on commit d8eb9ef

Please sign in to comment.