Skip to content

Commit

Permalink
Switch back to pull_request event for PR doc build (#1653)
Browse files Browse the repository at this point in the history
  • Loading branch information
regisss authored Feb 20, 2024
1 parent c9c103a commit 037c982
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
34 changes: 3 additions & 31 deletions .github/workflows/build_pr_documentation.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Build PR documentation

# WARNING: As this workflow supports the pull_request_target event, please exercise extra care when editing it.

on:
workflow_dispatch:
pull_request_target:
pull_request:
branches: [ main ]
types: [ opened, synchronize, reopened, labeled ]
paths:
- "optimum/**.py"
- "docs/**.mdx"
Expand All @@ -17,14 +14,7 @@ concurrency:
cancel-in-progress: true

jobs:
authorize:
if: (github.event.action == 'labeled' && github.event.label.name == 'build-pr-doc') || github.event_name != 'pull_request_target' || (! github.event.pull_request.head.repo.fork)
runs-on: ubuntu-latest
steps:
- run: true

build_documentation:
needs: authorize
runs-on: ubuntu-latest
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
Expand All @@ -42,7 +32,6 @@ jobs:
with:
repository: 'huggingface/optimum'
path: optimum
ref: ${{ github.event.pull_request.merge_commit_sha }}

- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -84,27 +73,10 @@ jobs:
sudo mv intel-doc-build ../optimum
cd ..
# TODO: enable Furiosa doc build in PRs once archive.furiosa.ai is public
- name: Make Furiosa documentation
run: |
cd optimum-furiosa
pip install .
sudo apt update
sudo apt install -y ca-certificates apt-transport-https gnupg
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 5F03AFA423A751913F249259814F888B20B09A7E
# TODO: remove secrets and pull_request_target once archive.furiosa.ai is public
sudo tee -a /etc/apt/auth.conf.d/furiosa.conf > /dev/null <<EOT
machine archive.furiosa.ai
login ${{ secrets.FURIOSA_ACCESS_KEY }}
password ${{ secrets.FURIOSA_SECRET_ACCESS_KEY }}
EOT
sudo chmod 400 /etc/apt/auth.conf.d/furiosa.conf
sudo tee -a /etc/apt/sources.list.d/furiosa.list <<EOT
deb [arch=amd64] https://archive.furiosa.ai/ubuntu jammy restricted
EOT
sudo apt update && sudo apt install -y furiosa-libnux
doc-builder build optimum.furiosa docs/source/ --build_dir furiosa-doc-build --version pr_$PR_NUMBER --version_tag_suffix "" --html --clean
mv furiosa-doc-build ../optimum
cd ..
echo "For PRs we don't build Furiosa doc"
- name: Make Optimum documentation
run: |
Expand Down
4 changes: 4 additions & 0 deletions docs/combine_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def main():
else:
subpackage_path = Path(f"{subpackage}-doc-build")

# The doc of Furiosa will be missing for PRs
if subpackage == "furiosa" and not subpackage_path.is_dir():
continue

# Copy all HTML files from subpackage into optimum
rename_copy_subpackage_html_paths(
subpackage,
Expand Down

0 comments on commit 037c982

Please sign in to comment.