|
1 | | -name: Upload PR documentation |
| 1 | +# name: Upload PR documentation |
2 | 2 |
|
3 | | -on: |
4 | | - workflow_call: |
5 | | - inputs: |
6 | | - package_name: |
7 | | - required: true |
8 | | - type: string |
9 | | - hub_base_path: |
10 | | - type: string |
11 | | - repo_owner: |
12 | | - type: string |
13 | | - default: 'huggingface' |
14 | | - description: "Owner of the repo to build documentation for. Defaults to 'huggingface'." |
15 | | - secrets: |
16 | | - hf_token: |
17 | | - required: true |
18 | | - comment_bot_token: |
19 | | - required: true |
| 3 | +# on: |
| 4 | +# workflow_call: |
| 5 | +# inputs: |
| 6 | +# package_name: |
| 7 | +# required: true |
| 8 | +# type: string |
| 9 | +# hub_base_path: |
| 10 | +# type: string |
| 11 | +# repo_owner: |
| 12 | +# type: string |
| 13 | +# default: 'huggingface' |
| 14 | +# description: "Owner of the repo to build documentation for. Defaults to 'huggingface'." |
| 15 | +# secrets: |
| 16 | +# hf_token: |
| 17 | +# required: true |
| 18 | +# comment_bot_token: |
| 19 | +# required: true |
20 | 20 |
|
21 | | -jobs: |
22 | | - upload_pr_documentation: |
23 | | - runs-on: ubuntu-latest |
24 | | - if: > |
25 | | - (github.event.workflow_run.event == 'pull_request' || |
26 | | - github.event.workflow_run.event == 'pull_request_target') && |
27 | | - github.event.workflow_run.conclusion == 'success' |
| 21 | +# jobs: |
| 22 | +# upload_pr_documentation: |
| 23 | +# runs-on: ubuntu-latest |
| 24 | +# if: > |
| 25 | +# (github.event.workflow_run.event == 'pull_request' || |
| 26 | +# github.event.workflow_run.event == 'pull_request_target') && |
| 27 | +# github.event.workflow_run.conclusion == 'success' |
28 | 28 |
|
29 | | - steps: |
30 | | - - uses: actions/checkout@v2 |
31 | | - with: |
32 | | - repository: 'huggingface/doc-builder' |
33 | | - path: doc-builder |
34 | | - # Uncomment the following line to use a specific revision of doc-builder |
35 | | - # ref: fix-corrupted-zip |
| 29 | +# steps: |
| 30 | +# - uses: actions/checkout@v2 |
| 31 | +# with: |
| 32 | +# repository: 'huggingface/doc-builder' |
| 33 | +# path: doc-builder |
| 34 | +# # Uncomment the following line to use a specific revision of doc-builder |
| 35 | +# # ref: fix-corrupted-zip |
36 | 36 |
|
37 | | - - name: Setup environment |
38 | | - shell: bash |
39 | | - run: | |
40 | | - pip install black |
41 | | - cd doc-builder |
42 | | - pip install . |
43 | | - cd .. |
44 | | - echo "current_work_dir=$(pwd)" >> $GITHUB_ENV |
| 37 | +# - name: Setup environment |
| 38 | +# shell: bash |
| 39 | +# run: | |
| 40 | +# pip install black |
| 41 | +# cd doc-builder |
| 42 | +# pip install . |
| 43 | +# cd .. |
| 44 | +# echo "current_work_dir=$(pwd)" >> $GITHUB_ENV |
45 | 45 |
|
46 | | - - name: 'Download artifact' |
47 | | - |
48 | | - with: |
49 | | - script: | |
50 | | - var artifacts = await github.actions.listWorkflowRunArtifacts({ |
51 | | - owner: context.repo.owner, |
52 | | - repo: context.repo.repo, |
53 | | - run_id: ${{github.event.workflow_run.id }}, |
54 | | - }); |
55 | | - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { |
56 | | - return artifact.name == "doc-build-artifact" |
57 | | - })[0]; |
58 | | - var download = await github.actions.downloadArtifact({ |
59 | | - owner: context.repo.owner, |
60 | | - repo: context.repo.repo, |
61 | | - artifact_id: matchArtifact.id, |
62 | | - archive_format: 'zip', |
63 | | - }); |
64 | | - var fs = require('fs'); |
65 | | - fs.writeFileSync('${{env.current_work_dir}}/doc-build-artifact.zip', Buffer.from(download.data)); |
| 46 | +# - name: 'Download artifact' |
| 47 | + |
| 48 | +# with: |
| 49 | +# script: | |
| 50 | +# var artifacts = await github.actions.listWorkflowRunArtifacts({ |
| 51 | +# owner: context.repo.owner, |
| 52 | +# repo: context.repo.repo, |
| 53 | +# run_id: ${{github.event.workflow_run.id }}, |
| 54 | +# }); |
| 55 | +# var matchArtifact = artifacts.data.artifacts.filter((artifact) => { |
| 56 | +# return artifact.name == "doc-build-artifact" |
| 57 | +# })[0]; |
| 58 | +# var download = await github.actions.downloadArtifact({ |
| 59 | +# owner: context.repo.owner, |
| 60 | +# repo: context.repo.repo, |
| 61 | +# artifact_id: matchArtifact.id, |
| 62 | +# archive_format: 'zip', |
| 63 | +# }); |
| 64 | +# var fs = require('fs'); |
| 65 | +# fs.writeFileSync('${{env.current_work_dir}}/doc-build-artifact.zip', Buffer.from(download.data)); |
66 | 66 |
|
67 | | - - run: | |
68 | | - mkdir build_dir |
69 | | - unzip doc-build-artifact.zip -d build_dir |
| 67 | +# - run: | |
| 68 | +# mkdir build_dir |
| 69 | +# unzip doc-build-artifact.zip -d build_dir |
70 | 70 |
|
71 | | - - name: Display structure of downloaded files |
72 | | - run: ls -l |
| 71 | +# - name: Display structure of downloaded files |
| 72 | +# run: ls -l |
73 | 73 |
|
74 | | - - name: Get commit_sha & pr_number |
75 | | - run: | |
76 | | - echo "commit_sha=$(cat ./build_dir/commit_sha)" >> $GITHUB_ENV |
77 | | - rm -rf ./build_dir/commit_sha |
78 | | - echo "pr_number=$(cat ./build_dir/pr_number)" >> $GITHUB_ENV |
79 | | - rm -rf ./build_dir/pr_number |
| 74 | +# - name: Get commit_sha & pr_number |
| 75 | +# run: | |
| 76 | +# echo "commit_sha=$(cat ./build_dir/commit_sha)" >> $GITHUB_ENV |
| 77 | +# rm -rf ./build_dir/commit_sha |
| 78 | +# echo "pr_number=$(cat ./build_dir/pr_number)" >> $GITHUB_ENV |
| 79 | +# rm -rf ./build_dir/pr_number |
80 | 80 |
|
81 | | - - name: Set hub_docs_url |
82 | | - run: | |
83 | | - if [ -z "${{ inputs.hub_base_path }}" ] |
84 | | - then |
85 | | - echo "hub_docs_url=https://moon-ci-docs.huggingface.co/docs/${{ inputs.package_name }}/pr_${{ env.pr_number }}" >> $GITHUB_ENV |
86 | | - echo "hub_base_path not provided, defaulting to https://moon-ci-docs.huggingface.co/docs" |
87 | | - else |
88 | | - echo "hub_docs_url=${{ inputs.hub_base_path }}/${{ inputs.package_name }}/pr_${{ env.pr_number }}" >> $GITHUB_ENV |
89 | | - fi |
| 81 | +# - name: Set hub_docs_url |
| 82 | +# run: | |
| 83 | +# if [ -z "${{ inputs.hub_base_path }}" ] |
| 84 | +# then |
| 85 | +# echo "hub_docs_url=https://moon-ci-docs.huggingface.co/docs/${{ inputs.package_name }}/pr_${{ env.pr_number }}" >> $GITHUB_ENV |
| 86 | +# echo "hub_base_path not provided, defaulting to https://moon-ci-docs.huggingface.co/docs" |
| 87 | +# else |
| 88 | +# echo "hub_docs_url=${{ inputs.hub_base_path }}/${{ inputs.package_name }}/pr_${{ env.pr_number }}" >> $GITHUB_ENV |
| 89 | +# fi |
90 | 90 |
|
91 | | - - name: Push to repositories |
92 | | - shell: bash |
93 | | - run: | |
94 | | - cd build_dir |
95 | | - doc-builder push ${{ inputs.package_name }} --doc_build_repo_id "hf-doc-build/doc-build-dev" --token "${{ secrets.hf_token }}" --commit_msg "Updated with commit ${{ env.commit_sha }} See: https://github.com/${{ inputs.repo_owner }}/${{ inputs.package_name }}/commit/${{ env.commit_sha }}" |
| 91 | +# - name: Push to repositories |
| 92 | +# shell: bash |
| 93 | +# run: | |
| 94 | +# cd build_dir |
| 95 | +# doc-builder push ${{ inputs.package_name }} --doc_build_repo_id "hf-doc-build/doc-build-dev" --token "${{ secrets.hf_token }}" --commit_msg "Updated with commit ${{ env.commit_sha }} See: https://github.com/${{ inputs.repo_owner }}/${{ inputs.package_name }}/commit/${{ env.commit_sha }}" |
96 | 96 |
|
97 | | - - name: Find doc comment |
98 | | - uses: peter-evans/find-comment@v2 |
99 | | - id: find_comment |
100 | | - with: |
101 | | - issue-number: ${{ env.pr_number }} |
102 | | - body-includes: docs for this PR |
| 97 | +# - name: Find doc comment |
| 98 | +# uses: peter-evans/find-comment@v2 |
| 99 | +# id: find_comment |
| 100 | +# with: |
| 101 | +# issue-number: ${{ env.pr_number }} |
| 102 | +# body-includes: docs for this PR |
103 | 103 |
|
104 | | - - name: Add doc comment if not present |
105 | | - uses: thollander/actions-comment-pull-request@v2 |
106 | | - if: steps.find_comment.outputs.comment-id == '' |
| 104 | +# - name: Add doc comment if not present |
| 105 | +# uses: thollander/actions-comment-pull-request@v2 |
| 106 | +# if: steps.find_comment.outputs.comment-id == '' |
107 | 107 |
|
108 | | - with: |
109 | | - message: 'The docs for this PR live [here](${{ env.hub_docs_url }}). All of your documentation changes will be reflected on that endpoint.' |
110 | | - pr_number: ${{ env.pr_number }} |
111 | | - GITHUB_TOKEN: ${{ secrets.comment_bot_token }} |
| 108 | +# with: |
| 109 | +# message: 'The docs for this PR live [here](${{ env.hub_docs_url }}). All of your documentation changes will be reflected on that endpoint.' |
| 110 | +# pr_number: ${{ env.pr_number }} |
| 111 | +# GITHUB_TOKEN: ${{ secrets.comment_bot_token }} |
112 | 112 |
|
113 | | - - name: Update doc comment if necessary |
114 | | - if: github.event.action == 'reopened' && steps.find_comment.outputs.comment-id != '' |
115 | | - uses: peter-evans/create-or-update-comment@v1 |
116 | | - with: |
117 | | - comment-id: ${{ steps.find_comment.outputs.comment-id }} |
118 | | - token: ${{ secrets.comment_bot_token }} |
119 | | - edit-mode: replace |
120 | | - body: | |
121 | | - The docs for this PR live [here](${{ env.hub_docs_url }}). All of your documentation changes will be reflected on that endpoint. |
| 113 | +# - name: Update doc comment if necessary |
| 114 | +# if: github.event.action == 'reopened' && steps.find_comment.outputs.comment-id != '' |
| 115 | +# uses: peter-evans/create-or-update-comment@v1 |
| 116 | +# with: |
| 117 | +# comment-id: ${{ steps.find_comment.outputs.comment-id }} |
| 118 | +# token: ${{ secrets.comment_bot_token }} |
| 119 | +# edit-mode: replace |
| 120 | +# body: | |
| 121 | +# The docs for this PR live [here](${{ env.hub_docs_url }}). All of your documentation changes will be reflected on that endpoint. |
0 commit comments