Skip to content

Docs imp

Docs imp #1

Workflow file for this run

name: Docs CI
permissions:
contents: write
pull-requests: write # For adding comments to PR.
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- '.github/actions/docs_build/**'
- 'README.md'
- 'docs/**'
- 'docs-export/**'
pull_request:
branches:
- 'main'
paths:
- '.github/actions/docs_build/**'
- 'README.md'
- 'docs/**'
- 'docs-export/**'
jobs:
poothon:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
# Update output format to enable automatic inline annotations.
- name: Run Ruff
run: ruff check --output-format=github .
skip-lint:
runs-on: ubuntu-latest
outputs:
should-lint: ${{ steps.nolint-pr-description.outputs.should-lint }}
steps:
- name: Validate PR Description
if: ${{ startsWith(github.ref, 'refs/pull/') }}
id: nolint-pr-description
run: |
# Fetch PR description using jq
PR_DESCRIPTION=$(jq -r ".pull_request.body" "$GITHUB_EVENT_PATH")
KEYWORD="[nolint]"
# Check for the required keyword in the PR description
if [[ $PR_DESCRIPTION != *"$KEYWORD"* ]]; then
echo "should-lint=yes" >> "$GITHUB_OUTPUT"
else
echo "::notice::Skipping linting due to [nolint] in PR description."
fi
lint:
runs-on: ubuntu-latest
needs: ['skip-lint']
if: ${{ needs.skip-lint.outputs.should-lint }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tj-actions/changed-files@v44
id: changed-files
with:
files: '**/*.md'
separator: ","
- uses: DavidAnson/markdownlint-cli2-action@v16
id: markdown-lint
if: steps.changed-files.outputs.any_changed == 'true'
with:
globs: ${{ steps.changed-files.outputs.all_changed_files }}
separator: ","
- name: Find possible previous comment
if: ${{ failure() && steps.markdown-lint.conclusion == 'failure'}}
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e
id: findComment
with:
issue-number: ${{ github.event.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- MARKDOWN_LINTER_WARNING -->'
- name: Update comment
if: ${{ failure() && steps.markdown-lint.conclusion == 'failure'}}
uses: peter-evans/create-or-update-commentcreate-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
comment-id: ${{ steps.findComment.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body: |
<!-- MARKDOWN_LINTER_WARNING -->
# New Linting Checks
We've detected that linting on an edited .md file has failed. We suggest that you fix any linting errors in newly added markdown lines.
You may also opt to resolve all linting errors in this file to help us avoid a massive lint commit on the entire repository.
edit-mode: replace
build:
if: ${{ always() }}
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout input ref
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Build md book
id: build-docs
uses: ./.github/actions/docs_build
with:
header-type: "branch"
doc-name: "${{ env.HEADER_TYPE }}"
book-dir: "docs-export"
redirect-url: "docs.ue4ss.com"
env:
HEADER_TYPE: ${{ startsWith(github.ref, 'refs/pull/') && github.ref || 'dev'}}
- uses: actions/upload-artifact@v4
if: ${{ startsWith(github.ref, 'refs/pull/') }}
with:
name: ${{ github.sha }}
path: ${{ steps.build-docs.outputs.output-dir }}
compression-level: 5
- name: Deploy to GitHub Pages
if: ${{github.ref == 'refs/heads/main'}}
uses: JamesIves/[email protected]
with:
folder: ~${{ steps.build-docs.outputs.output-dir }}
branch: gh-pages
target-folder: dev
clean: true