-
Notifications
You must be signed in to change notification settings - Fork 9
Add markdownlint pre-commit hooks, Build PRs on readthedocs #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
57f2d0e
6acedaf
cfa2a2c
d1bf9fa
3862fcd
80cb4ca
c15ec85
7334f8c
6067579
21fa40a
312117f
592e915
04c0995
b37955f
3a2a823
1279e0c
2825f21
a5d2acc
ed888af
210d5c1
89266ae
417f941
8d6ec0e
7c8946d
fbff1ce
9d48594
38cf8ee
6d02ed8
749c1d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # CODEOWNERS — automatic review suggestions | ||
| # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners | ||
| # GitHub automatically suggests dev-guide-admins as reviewers for all PRs. | ||
|
|
||
| # Request review from dev-guide-admins team for all files | ||
| * @lasp/dev-guide-admins |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: Docs Build | ||
|
|
||
| # Fast CI error-gate: catches broken toctrees, bad references, and Sphinx | ||
| # warnings before merge. Runs in ~2 min. | ||
| # | ||
| # The live browsable preview is handled by ReadTheDocs, which posts its own | ||
| # status check ("docs/readthedocs.com") with a direct URL when a PR build | ||
| # completes. Enable it once in the RTD dashboard: | ||
| # Admin → Advanced Settings → "Build pull requests for this project" ✓ | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
|
|
||
| env: | ||
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | ||
|
|
||
| jobs: | ||
| sphinx: | ||
| name: Build Sphinx docs | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install Poetry | ||
| run: python -m pip install poetry | ||
|
|
||
| - name: Install dependencies | ||
| run: poetry install | ||
|
|
||
| - name: Build docs (warnings = errors) | ||
| id: build | ||
| shell: bash | ||
| run: | | ||
| set -o pipefail | ||
| poetry run sphinx-build -W --keep-going -n \ | ||
| docs/source docs/source/build 2>&1 | tee /tmp/sphinx-output.txt | ||
|
|
||
| - name: Write job summary | ||
| if: always() | ||
| shell: bash | ||
| run: | | ||
| { | ||
| echo "## Sphinx Docs Build" | ||
| echo "" | ||
| if [ "${{ steps.build.outcome }}" = "success" ]; then | ||
| echo "### Build passed — no warnings" | ||
| else | ||
| echo "### Build failed — see warnings below" | ||
| fi | ||
| echo "" | ||
| echo "> **Live preview:** see the **ReadTheDocs** status check below for a" | ||
| echo "> clickable URL to browse the built docs directly." | ||
| echo "" | ||
| if [ -f /tmp/sphinx-output.txt ]; then | ||
| echo "<details><summary>Full Sphinx output</summary>" | ||
| echo "" | ||
| echo '```' | ||
| cat /tmp/sphinx-output.txt | ||
| echo '```' | ||
| echo "" | ||
| echo "</details>" | ||
| fi | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: PR Triage | ||
|
|
||
| # Automatically request review from dev-guide-admins when a PR is ready for review. | ||
| # Covers two cases: | ||
| # - PR opened directly as ready for review (opened, reopened) | ||
| # - Draft PR converted to ready for review (ready_for_review) | ||
| on: | ||
| pull_request_target: | ||
| types: [opened, reopened, ready_for_review] | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| env: | ||
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | ||
|
|
||
| jobs: | ||
| triage: | ||
| name: Request review from triage team | ||
| # Skip draft PRs — only run when the PR is actually ready for review | ||
| if: github.event.pull_request.draft == false | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| # Request review from the dev-guide-admins team. | ||
| # Also posts a comment mentioning the team as a reliable fallback notification, | ||
| # since requestReviewers can silently fail for teams in some org configurations. | ||
| - name: Request review and notify dev-guide-admins | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const pr = context.payload.pull_request.number; | ||
| const { owner, repo } = context.repo; | ||
|
|
||
| // Attempt to assign the team as a formal reviewer | ||
| try { | ||
| await github.rest.pulls.requestReviewers({ | ||
| owner, | ||
| repo, | ||
| pull_number: pr, | ||
| team_reviewers: ['dev-guide-admins'], | ||
| }); | ||
| console.log('Successfully requested review from dev-guide-admins'); | ||
| } catch (err) { | ||
| // Log the error but don't fail — the comment below still notifies the team | ||
| console.error('requestReviewers failed:', err.message); | ||
| } | ||
|
|
||
| // Post a comment mentioning the team so they are always notified | ||
| await github.rest.issues.createComment({ | ||
| owner, | ||
| repo, | ||
| issue_number: pr, | ||
| body: '@lasp/dev-guide-admins — this PR is ready for review.', | ||
| }); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,13 +1,23 @@ | ||||||
| name: Dependency Check | ||||||
|
|
||||||
| # Verifies that the Poetry dependency lock-file resolves cleanly across the | ||||||
| # supported Python range. Doc building is handled by the separate docs.yml job. | ||||||
| on: | ||||||
| pull_request: | ||||||
| types: [opened, synchronize, edited] | ||||||
| types: [opened, synchronize, edited, reopened] | ||||||
|
|
||||||
| # Opt into Node.js 24 for all actions in this workflow. | ||||||
| # Remove once actions/checkout and actions/setup-python release | ||||||
| # versions that natively target Node.js 24. | ||||||
| env: | ||||||
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | ||||||
|
|
||||||
| jobs: | ||||||
| build: | ||||||
| name: Install deps (Python ${{ matrix.python-version }}, ${{ matrix.os }}) | ||||||
| runs-on: ${{ matrix.os }} | ||||||
| strategy: | ||||||
| fail-fast: false | ||||||
| matrix: | ||||||
| os: [ubuntu-latest, macos-latest] | ||||||
| python-version: ['3.10', '3.11'] | ||||||
|
|
@@ -16,12 +26,12 @@ jobs: | |||||
| shell: bash | ||||||
|
|
||||||
| steps: | ||||||
| - uses: actions/checkout@v3 | ||||||
| - uses: actions/checkout@v4 | ||||||
| - name: Set up Python ${{ matrix.python-version }} | ||||||
| uses: actions/setup-python@v4 | ||||||
| uses: actions/setup-python@v5 | ||||||
| with: | ||||||
| python-version: ${{ matrix.python-version }} | ||||||
| - uses: Gr1N/setup-poetry@v8 | ||||||
| - name: Install dependencies and app | ||||||
| run: | | ||||||
| poetry install | ||||||
| - name: Install Poetry | ||||||
| run: python -m pip install poetry | ||||||
|
||||||
| run: python -m pip install poetry | |
| run: python -m pip install "poetry==1.8.3" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| .idea/ | ||
| docs/source/build | ||
| docs/build | ||
| docs/build |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Markdownlint configuration for markdownlint-cli2 (Node.js) | ||
| # Rule reference: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md | ||
| # | ||
| # This mirrors the exclusions in .mdl_style.rb (used by the Ruby mdl gem) | ||
| # so both tools agree. The .mdlrc / .mdl_style.rb files can be retired once | ||
| # the team is fully on markdownlint-cli. | ||
|
|
||
| default: true | ||
|
|
||
| # -- Line length -------------------------------------------------------------- | ||
| # 120 chars max; code blocks and tables are exempt (same as .mdl_style.rb) | ||
| MD013: | ||
| line_length: 120 | ||
| code_blocks: false | ||
| tables: false | ||
| headings: false | ||
|
|
||
| # -- Disabled rules (match .mdl_style.rb exclusions) ------------------------- | ||
| MD014: false # Dollar signs before commands without showing output — allowed | ||
| MD029: false # Ordered list item prefix — allow repeating "1." style | ||
| MD033: false # Inline HTML — allowed | ||
| MD034: false # Bare URLs — allowed | ||
| MD036: false # Emphasis used instead of a heading — allowed | ||
|
|
||
| # -- Additional sensible rules ------------------------------------------------ | ||
| # Enforce consistent heading style (ATX = # style, not underline style) | ||
| MD003: | ||
| style: atx | ||
|
|
||
| # Enforce consistent unordered list marker (* vs - vs +) | ||
| MD004: | ||
| style: consistent | ||
|
|
||
| # No multiple blank lines | ||
| MD012: | ||
| maximum: 1 | ||
|
|
||
| # No hard tabs | ||
| MD010: | ||
| spaces_per_tab: 4 | ||
|
|
||
| # Fenced code blocks should have a language specified | ||
| MD040: true | ||
|
|
||
| # No trailing punctuation in headings | ||
| MD026: | ||
| punctuation: ".,;:!" | ||
|
|
||
| # -- Disabled rules (repo convention) ----------------------------------------- | ||
| # The guideline template consistently uses 2-space sub-bullets under numbered | ||
| # lists (e.g., 1. **Step** \n - detail). Enforcing MD007 would require | ||
| # rewriting every How-to-Apply section across the whole site. | ||
| MD007: false | ||
|
|
||
| # Tight lists (no blank lines between items) are idiomatic in this repo's | ||
| # guideline pages. MD032 would require blank lines around every list block. | ||
| MD032: false | ||
|
|
||
| # Table column alignment style is overly strict for contributors and produces | ||
| # false positives on wide-cell tables — disable until a consistent table style | ||
| # is established across the whole site. | ||
| MD060: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| style "#{File.dirname(__FILE__)}/.mdl_style.rb" | ||
| style "#{File.dirname(__FILE__)}/.mdl_style.rb" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,21 +1,86 @@ | ||||||
| ci: | ||||||
| autofix_prs: false | ||||||
| # pre-commit.ci (https://pre-commit.ci) — free for open-source repos. | ||||||
| # When enabled, it runs all hooks on every PR and commits any auto-fixes | ||||||
| # back to the PR branch automatically (no local setup required for contributors). | ||||||
| # Hooks that can auto-fix: end-of-file-fixer, trailing-whitespace, | ||||||
| # mixed-line-ending, markdownlint (--fix), codespell (--write-changes). | ||||||
| # Hooks that only detect (still require a human fix): check-yaml, | ||||||
| # check-merge-conflict, rstcheck, yamllint. | ||||||
| autofix_prs: true | ||||||
| autoupdate_schedule: 'quarterly' | ||||||
| # rstcheck needs a full Sphinx/Poetry environment that pre-commit.ci | ||||||
| # doesn't have — skip it there and let docs.yml in GitHub Actions cover it. | ||||||
| skip: [rstcheck] | ||||||
|
|
||||||
| repos: | ||||||
| # --------------------------------------------------------------------------- | ||||||
| # General file hygiene | ||||||
| # --------------------------------------------------------------------------- | ||||||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||||||
| rev: v5.0.0 | ||||||
| hooks: | ||||||
| - id: check-added-large-files | ||||||
| args: ['--maxkb=1000'] | ||||||
| - id: detect-aws-credentials | ||||||
| args: [--allow-missing-credentials] | ||||||
| - id: detect-private-key | ||||||
| - id: mixed-line-ending | ||||||
| - id: trailing-whitespace | ||||||
| - id: no-commit-to-branch | ||||||
| args: [--branch, main] | ||||||
| - id: check-added-large-files # block files > 1 MB | ||||||
| args: ['--maxkb=1000'] | ||||||
| - id: check-case-conflict # catch Mac/Windows case insensitivity bugs | ||||||
| - id: check-merge-conflict # catch leftover <<<< ==== >>>> markers | ||||||
| - id: check-yaml # validate all YAML files (workflows, config) | ||||||
| - id: detect-aws-credentials | ||||||
| args: [--allow-missing-credentials] | ||||||
| - id: detect-private-key | ||||||
| - id: end-of-file-fixer # ensure every file ends with a newline | ||||||
| - id: mixed-line-ending | ||||||
| - id: no-commit-to-branch | ||||||
| args: [--branch, main] | ||||||
| - id: trailing-whitespace | ||||||
| # --markdown-linebreak-ext preserves intentional two-space line breaks in .md | ||||||
| args: [--markdown-linebreak-ext=md] | ||||||
|
|
||||||
| # --------------------------------------------------------------------------- | ||||||
| # Markdown linting | ||||||
| # Config: .markdownlint.yaml (mirrors the existing .mdl_style.rb exclusions) | ||||||
| # markdownlint-cli2 is the official CLI maintained by the markdownlint author (DavidAnson). | ||||||
| # --------------------------------------------------------------------------- | ||||||
| - repo: https://github.com/DavidAnson/markdownlint-cli2 | ||||||
| rev: v0.19.1 | ||||||
|
||||||
| rev: v0.19.1 | |
| rev: v0.22.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # yamllint configuration | ||
| # Docs: https://yamllint.readthedocs.io/en/stable/configuration.html | ||
| --- | ||
| extends: default | ||
|
|
||
| rules: | ||
| # Match the project's 120-char line limit; URLs in comments are exempt | ||
| line-length: | ||
| max: 120 | ||
| allow-non-breakable-words: true | ||
| allow-non-breakable-inline-mappings: true | ||
|
|
||
| # GitHub Actions uses `on:` as a top-level key; yamllint flags it as a | ||
| # truthy value by default, so we explicitly allow it | ||
| truthy: | ||
| allowed-values: ['true', 'false'] | ||
| check-keys: false # disables the 'on:' / 'yes:' key warning | ||
|
|
||
| # Allow both block and flow sequences | ||
| braces: | ||
| min-spaces-inside: 0 | ||
| max-spaces-inside: 1 | ||
|
|
||
| # Do not require documents to start with --- (document-start rule disabled) | ||
| document-start: disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs workflow uses Python 3.11, but ReadTheDocs is configured for Python 3.10. This can lead to "passes in GitHub Actions, fails on RTD" (or vice-versa) if a dependency or Sphinx behavior differs across Python versions. Consider aligning the Python version between docs.yml and .readthedocs.yaml (or explicitly testing both).