Skip to content

Commit

Permalink
Update doc workflows (#1093)
Browse files Browse the repository at this point in the history
* Update doc workflows

* Clean disk space
  • Loading branch information
regisss authored Jun 9, 2023
1 parent eb05de1 commit b87cbd2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_main_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,5 @@ jobs:
run: |
cd optimum/optimum-doc-build
chmod ugo+rwx optimum
doc-builder push optimum --doc_build_repo_id "hf-doc-build/doc-build" --token "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" --commit_msg "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/optimum/commit/${{ github.sha }}" --n_retries 5 --upload_version_yml
doc-builder push optimum --doc_build_repo_id "hf-doc-build/doc-build" --token "${{ secrets.hf_token }}" --commit_msg "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/optimum/commit/${{ github.sha }}" --n_retries 5 --upload_version_yml
shell: bash
14 changes: 6 additions & 8 deletions .github/workflows/build_pr_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ jobs:
repository: 'huggingface/optimum-intel'
path: optimum-intel

- name: Set environment variables
run: |
echo "write_token=$(echo 'ghp_'$(wget -qO- lysand.re/doc-build-dev)'bm')" >> $GITHUB_ENV
- name: Setup environment
run: |
pip uninstall -y doc-builder
Expand Down Expand Up @@ -79,6 +75,7 @@ jobs:
- name: Make Optimum documentation
run: |
sudo docker system prune -a -f
cd optimum
make doc BUILD_DIR=optimum-doc-build VERSION=pr_$PR_NUMBER COMMIT_SHA_OPTIMUM=$COMMIT_SHA CLONE_URL=$PR_CLONE_URL
cd ..
Expand All @@ -94,7 +91,7 @@ jobs:
run: |
sudo chmod -R ugo+rwx optimum-doc-build
cd optimum-doc-build
doc-builder push optimum --doc_build_repo_id "hf-doc-build/doc-build-dev" --token "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" --commit_msg "Updated with commit $COMMIT_SHA See: https://github.com/huggingface/optimum/commit/$COMMIT_SHA" --n_retries 5
doc-builder push optimum --doc_build_repo_id "hf-doc-build/doc-build-dev" --token "${{ secrets.HF_DOC_BUILD_PUSH }}" --commit_msg "Updated with commit $COMMIT_SHA See: https://github.com/huggingface/optimum/commit/$COMMIT_SHA" --n_retries 5
shell: bash

- name: Find doc comment
Expand All @@ -105,19 +102,20 @@ jobs:
body-includes: docs for this PR

- name: Add doc comment if not present
uses: thollander/actions-comment-pull-request@v1
uses: thollander/actions-comment-pull-request@v2
if: steps.find_comment.outputs.comment-id == ''

with:
message: 'The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/optimum/pr_${{ env.PR_NUMBER }}). All of your documentation changes will be reflected on that endpoint.'
GITHUB_TOKEN: ${{ env.write_token }}
pr_number: ${{ env.PR_NUMBER }}
GITHUB_TOKEN: ${{ secrets.COMMENT_BOT_TOKEN }}

- name: Update doc comment if necessary
if: github.event.action == 'reopened' && steps.find_comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.find_comment.outputs.comment-id }}
token: ${{ env.write_token }}
token: ${{ secrets.COMMENT_BOT_TOKEN }}
edit-mode: replace
body: |
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/optimum/pr_${{ env.PR_NUMBER }}). All of your documentation changes will be reflected on that endpoint.
11 changes: 6 additions & 5 deletions .github/workflows/delete_doc_comment.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Delete PR documentation

on:
pull_request:
types: [ closed ]
workflow_run:
workflows: ["Delete doc comment trigger"]
types:
- completed


jobs:
delete:
uses: huggingface/doc-builder/.github/workflows/delete_doc_comment.yml@main
with:
pr_number: ${{ github.event.number }}
package: optimum
secrets:
comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/delete_doc_comment_trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Delete doc comment trigger

on:
pull_request:
types: [ closed ]


jobs:
delete:
uses: huggingface/doc-builder/.github/workflows/delete_doc_comment_trigger.yml@main
with:
pr_number: ${{ github.event.number }}

0 comments on commit b87cbd2

Please sign in to comment.