# Generated from xtask::workflows::run_docs_checks
# Rebuild with `cargo xtask workflows`.
name: run_docs_checks
env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: '1'
  CARGO_INCREMENTAL: '0'
on:
  pull_request:
    branches:
    - '**'
    paths:
    - docs/**
    - crates/docs_preprocessor/**
  push:
    branches:
    - main
    - v[0-9]+.[0-9]+.x
    paths:
    - docs/**
    - crates/docs_preprocessor/**
jobs:
  check_docs:
    if: github.repository_owner == 'zed-industries'
    runs-on: namespace-profile-8x16-ubuntu-2204
    steps:
    - name: steps::checkout_repo
      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
      with:
        clean: false
    - name: steps::setup_cargo_config
      run: |
        mkdir -p ./../.cargo
        cp ./.cargo/ci-config.toml ./../.cargo/config.toml
      shell: bash -euxo pipefail {0}
    - name: steps::cache_rust_dependencies
      uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
      with:
        save-if: ${{ github.ref == 'refs/heads/main' }}
    - name: run_docs_checks::lychee_link_check
      uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
      with:
        args: --no-progress --exclude '^http' './docs/src/**/*'
        fail: true
    - name: steps::setup_linux
      run: ./script/linux
      shell: bash -euxo pipefail {0}
    - name: steps::install_mold
      run: ./script/install-mold
      shell: bash -euxo pipefail {0}
    - name: run_docs_checks::install_mdbook
      uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08
      with:
        mdbook-version: 0.4.37
    - name: run_docs_checks::build_docs
      run: |
        mkdir -p target/deploy
        mdbook build ./docs --dest-dir=../target/deploy/docs/
      shell: bash -euxo pipefail {0}
    - name: run_docs_checks::lychee_link_check
      uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
      with:
        args: --no-progress --exclude '^http' 'target/deploy/docs'
        fail: true
    timeout-minutes: 60
concurrency:
  group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
  cancel-in-progress: true
