Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push events to main and preview
push:
branches:
- main
- preview

# Allows you to run this workflow manually from the Actions tab
branches:
- main
- preview
pull_request:
branches:
- main
- preview
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains jobs called "Build-Main" and "Build-Preview"
Check-Links:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Test link checker
run: python -m unittest discover -s tests
- name: Check newly introduced external links
env:
BASE_REF: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
if [[ -z "$BASE_REF" || "$BASE_REF" =~ ^0+$ ]]; then
BASE_REF=HEAD^
fi
python check_links.py --base-ref "$BASE_REF"

Build-Main:
if: ${{ github.ref == 'refs/heads/main' }}
needs: Check-Links
uses: dynamsoft-docs/Docs-Template-Repo/.github/workflows/called-workflow-build-sync-production.yml@main
with:
doc-repo: faq
Expand All @@ -26,6 +45,7 @@ jobs:

Build-Preview:
if: ${{ github.ref == 'refs/heads/preview' }}
needs: Check-Links
uses: dynamsoft-docs/Docs-Template-Repo/.github/workflows/called-workflow-build-sync-testing.yml@preview
with:
doc-repo: faq
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ temp/*
!temp/keep.txt
.idea
.dev/
# *.py
# *.py
__pycache__/
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ The scripts clone the shared template's preview branch into `.dev/`, merge it wi

## Checking links

`check_links.py` crawls the repo's Markdown files and reports broken links. Run it before submitting a change that touches links:
`check_links.py` checks external HTTP(S) links in publishable FAQ Markdown (not archived pages or generated workspaces). It verifies HTTPS certificates, reports confirmed 4xx and Dynamsoft soft-404 pages as failures, and reports access-denied, rate-limited, server, and network errors as inconclusive warnings. It does not check relative links or anchors; the shared Jekyll template performs its own internal-link check during the build.

```bash
python check_links.py
```
`python check_links.py` checks all published Markdown and exits nonzero for confirmed broken URLs. Existing broken URLs may be reported until fixed. GitHub Actions checks only URLs newly introduced since the PR base or preceding push, so legacy failures do not block unrelated changes. The separate `Check-Links` job must pass before the build-and-sync jobs run on `main` and `preview`.
Loading
Loading