First attempt to add Doctor-RST #957
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linting | |
on: | |
pull_request: | |
jobs: | |
prose: | |
runs-on: ubuntu-22.04 # See https://github.com/errata-ai/vale-action/issues/128 before upgrading | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
cache: 'pip' | |
- name: Install Python dependencies | |
run: pip3 install -r docs/requirements.txt | |
- name: Vale | |
uses: errata-ai/vale-action@reviewdog | |
with: | |
version: 3.7.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
cache: 'pip' | |
- name: Install Python dependencies | |
run: pip3 install -r docs/requirements.txt | |
- name: Build docs | |
working-directory: docs | |
run: make html | |
- name: Check links | |
working-directory: docs | |
run: make checklinks | |
doctor_rst: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Ensures full history is fetched | |
- name: Extract base branch name | |
run: echo "branch=$(echo ${GITHUB_BASE_REF:=${GITHUB_REF##*/}})" >> $GITHUB_ENV | |
id: extract_base_branch | |
- name: Get Changed Files | |
id: changes | |
run: | | |
git fetch origin ${{ github.event.pull_request.base.ref }} # Fetch the base branch | |
CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }} | grep '^docs/' | grep -v '.doctor-rst.yaml' | tr '\n' ' ') | |
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV | |
- name: Cache DOCtor-RST | |
uses: actions/cache@v2 | |
with: | |
path: .cache | |
key: doctor-rst-${{ runner.os }}-${{ env.branch }} | |
restore-keys: | | |
doctor-rst-${{ runner.os }}- | |
doctor-rst- | |
- name: Run DOCtor-RST | |
if: env.CHANGED_FILES != '' | |
run: | | |
for file in ${{ env.CHANGED_FILES }}; do | |
docker run --rm -v "${{ github.workspace }}:/github/workspace" -w /github/workspace/docs oskarstark/doctor-rst --short --error-format=github --cache-file=/github/workspace/.cache/doctor-rst.cache $(basename $file) | |
done |