mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-02 18:45:14 +01:00
chore: Rebuild docs if linting fails
This commit is contained in:
74
.github/workflows/lint-docs.yml
vendored
74
.github/workflows/lint-docs.yml
vendored
@@ -1,74 +0,0 @@
|
|||||||
name: Lint Docs
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
- ready_for_review
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [16.x]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
||||||
ref: ${{ github.event.pull_request.head.ref }}
|
|
||||||
|
|
||||||
- name: Get branch name
|
|
||||||
id: branch-name
|
|
||||||
uses: tj-actions/branch-names@v5
|
|
||||||
|
|
||||||
- uses: nrwl/last-successful-commit-action@v1
|
|
||||||
id: last_successful_commit_pull_request
|
|
||||||
with:
|
|
||||||
branch: ${{ steps.branch-name.outputs.base_ref_branch }}
|
|
||||||
workflow_id: 'lint-docs.yml'
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Check if source docs are changed
|
|
||||||
id: changed-docs
|
|
||||||
uses: tj-actions/changed-files@v29
|
|
||||||
with:
|
|
||||||
base_sha: ${{ steps.last_successful_commit_pull_request.outputs.commit_hash }}
|
|
||||||
files: |
|
|
||||||
packages/mermaid/src/docs/*
|
|
||||||
packages/mermaid/src/docs.mts
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v2
|
|
||||||
if: steps.changed-docs.outputs.only_modified == 'true'
|
|
||||||
|
|
||||||
- name: Setup Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
if: steps.changed-docs.outputs.only_modified == 'true'
|
|
||||||
with:
|
|
||||||
cache: pnpm
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
|
|
||||||
- name: Install Packages
|
|
||||||
if: steps.changed-docs.outputs.only_modified == 'true'
|
|
||||||
run: |
|
|
||||||
pnpm install --frozen-lockfile
|
|
||||||
env:
|
|
||||||
CYPRESS_CACHE_FOLDER: .cache/Cypress
|
|
||||||
|
|
||||||
- name: Run step if any file(s) in the docs folder change
|
|
||||||
if: steps.changed-docs.outputs.only_modified == 'true'
|
|
||||||
run: |
|
|
||||||
echo "Only files in the src/docs folder has changed."
|
|
||||||
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
|
|
||||||
yarn docs:build
|
|
||||||
|
|
||||||
- name: Commit changes
|
|
||||||
uses: EndBug/add-and-commit@v9
|
|
||||||
if: steps.changed-docs.outputs.only_modified == 'true'
|
|
||||||
with:
|
|
||||||
message: 'Update docs'
|
|
||||||
add: 'docs/*'
|
|
||||||
16
.github/workflows/lint.yml
vendored
16
.github/workflows/lint.yml
vendored
@@ -9,7 +9,7 @@ on:
|
|||||||
- ready_for_review
|
- ready_for_review
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
@@ -39,5 +39,19 @@ jobs:
|
|||||||
run: pnpm run lint
|
run: pnpm run lint
|
||||||
|
|
||||||
- name: Verify Docs
|
- name: Verify Docs
|
||||||
|
id: verifyDocs
|
||||||
working-directory: ./packages/mermaid
|
working-directory: ./packages/mermaid
|
||||||
|
continue-on-error: true
|
||||||
run: pnpm run docs:verify
|
run: pnpm run docs:verify
|
||||||
|
|
||||||
|
- name: Rebuild Docs
|
||||||
|
if: ${{ steps.verifyDocs.outcome == 'failure' && github.event_name == 'push' }}
|
||||||
|
run: |
|
||||||
|
yarn docs:build
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
uses: EndBug/add-and-commit@v9
|
||||||
|
if: ${{ steps.verifyDocs.outcome == 'failure' && github.event_name == 'push' }}
|
||||||
|
with:
|
||||||
|
message: 'Update docs'
|
||||||
|
add: 'docs/*'
|
||||||
|
|||||||
Reference in New Issue
Block a user