Skip to content

avoid running this wf from fork #127768

avoid running this wf from fork

avoid running this wf from fork #127768

name: Build PR Documentation
on:
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check_links:
permissions:
contents: read
name: Check documentation links
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
outputs:
python_version: ${{ steps.python_version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Read Python version
id: python_version
run: |
version=$(tr -d '[:space:]' < .python-version)
[[ "$version" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]] || { echo "Invalid .python-version: $version"; exit 1; }
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version-file: .python-version
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install doc-builder
run: |
uv pip install --system git+https://github.com/huggingface/doc-builder.git@main
- name: Check documentation links
run: |
uv run doc-builder check-links docs/source/en
build:
needs: check_links
if: github.event_name == 'pull_request'
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@9b0e5b334b65d006b59e0b1a022a33122f7e12aa # main
with:
commit_sha: ${{ github.event.pull_request.head.sha }}
pr_number: ${{ github.event.number }}
package: transformers
path_to_docs: transformers/docs/source/en/
python_version: ${{ needs.check_links.outputs.python_version }}
# Satisfy required check in merge queue without actually building docs
skip_merge_queue:
permissions: {}
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
steps:
- run: echo "Skipping doc build in merge queue"
doc_build_status_check:
permissions: {}
needs: [build, check_links, skip_merge_queue]
if: always()
runs-on: ubuntu-latest
steps:
- run: |
if [[ "${{ needs.build.result }}" == "success" || "${{ needs.build.result }}" == "skipped" ]] && \
[[ "${{ needs.check_links.result }}" == "success" || "${{ needs.check_links.result }}" == "skipped" ]] && \
[[ "${{ needs.skip_merge_queue.result }}" == "success" || "${{ needs.skip_merge_queue.result }}" == "skipped" ]]; then
echo "OK"
else
exit 1
fi