From d0e7cf549876ba3d7c2c5145ee25ea1c38db9d0d Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 10:20:15 -0500 Subject: [PATCH 01/21] Update delete-dev-doc job to match build-dev-doc --- .../workflows/delete_dev_documentation.yml | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/delete_dev_documentation.yml b/.github/workflows/delete_dev_documentation.yml index e3e6f217405fc..2b65b9797219a 100644 --- a/.github/workflows/delete_dev_documentation.yml +++ b/.github/workflows/delete_dev_documentation.yml @@ -7,23 +7,21 @@ on: jobs: build_and_package: - runs-on: [self-hosted, doc-builder] + runs-on: ubuntu-latest container: - image: huggingface/doc-builder-transformers - options: "-v /home/github_actions:/mnt" + image: huggingface/transformers-doc-builder env: PR_NUMBER: ${{ github.event.number }} steps: - - uses: actions/checkout@v2 - name: Set env - run: echo "WRITE=$(cat /mnt/WRITE)" >> $GITHUB_ENV - - - uses: actions/checkout@v2 - with: - repository: 'huggingface/doc-build-dev' - path: doc-build-dev - token: ${{ env.WRITE }} + run: | + echo "WRITE=$(echo 'ghp_'$(wget -qO- lysand.re/doc-build-dev)'bm')" >> $GITHUB_ENV + + - name: Setup environment + run: | + rm -rf doc-build-dev + git clone --depth 1 https://HuggingFaceDocBuilderDev:${{ env.WRITE }}@github.com/huggingface/doc-build-dev - name: Setup git run: | From 1123c5693545d51727a4851244dd97b256807d7f Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 10:38:51 -0500 Subject: [PATCH 02/21] More debug info --- .github/workflows/delete_dev_documentation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/delete_dev_documentation.yml b/.github/workflows/delete_dev_documentation.yml index 2b65b9797219a..47799a9ab501d 100644 --- a/.github/workflows/delete_dev_documentation.yml +++ b/.github/workflows/delete_dev_documentation.yml @@ -31,9 +31,9 @@ jobs: - name: Push to repositories run: | cd doc-build-dev - ls + ls transformers rm -rf transformers/pr_$PR_NUMBER - ls + ls transformers git add . git commit -m "Closed PR ${GITHUB_REF##*/}" git push origin main From 864b5bcafbf610e91f33b30ac8e532aaa56bd1e2 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 10:39:00 -0500 Subject: [PATCH 03/21] More debug info --- .github/workflows/delete_dev_documentation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/delete_dev_documentation.yml b/.github/workflows/delete_dev_documentation.yml index 47799a9ab501d..e654493092a8a 100644 --- a/.github/workflows/delete_dev_documentation.yml +++ b/.github/workflows/delete_dev_documentation.yml @@ -34,6 +34,7 @@ jobs: ls transformers rm -rf transformers/pr_$PR_NUMBER ls transformers + git status git add . git commit -m "Closed PR ${GITHUB_REF##*/}" git push origin main From b9882c21aad3dd6178a684cf70779d8dc16bf67f Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 11:27:55 -0500 Subject: [PATCH 04/21] Stash if needed --- .github/workflows/build_dev_documentation.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 4e9f1e171acff..650af25ac16a6 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -98,6 +98,12 @@ jobs: cd doc-build-dev && git pull cd ../doc-builder doc-builder build transformers ../transformers/docs/source --build_dir ../doc-build-dev --notebook_dir ../notebooks/transformers_doc --clean --version pr_$PR_NUMBER --html + if [[ `git status --porcelain` ]]; then + cd ../doc-build-dev && git stash && git pull && git stash apply && cd .. + else + echo "No diff in the documentation." + cd .. + fi - name: Push to repositories run: | From 2d5892d1baf67df0029035f3d19e9643b7993f45 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 11:50:42 -0500 Subject: [PATCH 05/21] Remove the comment update --- .github/workflows/build_dev_documentation.yml | 34 +++++++++---------- .../workflows/delete_dev_documentation.yml | 34 +++++++++---------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 650af25ac16a6..3a8bbfdb961a1 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -73,23 +73,23 @@ jobs: message: 'The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_${{ env.PR_NUMBER }}). All of your documentation changes will be reflected on that endpoint.' GITHUB_TOKEN: ${{ env.WRITE }} - - name: Find Comment - if: github.event.action == 'reopened' - uses: peter-evans/find-comment@v1 - id: fc - with: - issue-number: ${{ env.PR_NUMBER }} - comment-author: HuggingFaceDocBuilder - - - name: Update comment - if: github.event.action == 'reopened' - uses: peter-evans/create-or-update-comment@v1 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - token: ${{ env.WRITE }} - edit-mode: replace - body: | - The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_${{ env.PR_NUMBER }}). All of your documentation changes will be reflected on that endpoint. +# - name: Find Comment +# if: github.event.action == 'reopened' +# uses: peter-evans/find-comment@v1 +# id: fc +# with: +# issue-number: ${{ env.PR_NUMBER }} +# comment-author: HuggingFaceDocBuilder + +# - name: Update comment +# if: github.event.action == 'reopened' +# uses: peter-evans/create-or-update-comment@v1 +# with: +# comment-id: ${{ steps.fc.outputs.comment-id }} +# token: ${{ env.WRITE }} +# edit-mode: replace +# body: | +# The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_${{ env.PR_NUMBER }}). All of your documentation changes will be reflected on that endpoint. - name: Make documentation env: diff --git a/.github/workflows/delete_dev_documentation.yml b/.github/workflows/delete_dev_documentation.yml index e654493092a8a..39020fdf7bd16 100644 --- a/.github/workflows/delete_dev_documentation.yml +++ b/.github/workflows/delete_dev_documentation.yml @@ -39,20 +39,20 @@ jobs: git commit -m "Closed PR ${GITHUB_REF##*/}" git push origin main - - name: Find Comment - if: ${{ always() }} - uses: peter-evans/find-comment@v1 - id: fc - with: - issue-number: ${{ env.PR_NUMBER }} - comment-author: HuggingFaceDocBuilder - - - name: Update comment - if: ${{ always() }} - uses: peter-evans/create-or-update-comment@v1 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - token: ${{ env.WRITE }} - edit-mode: replace - body: | - _The documentation is not available anymore as the PR was closed or merged._ +# - name: Find Comment +# if: ${{ always() }} +# uses: peter-evans/find-comment@v1 +# id: fc +# with: +# issue-number: ${{ env.PR_NUMBER }} +# comment-author: HuggingFaceDocBuilder + +# - name: Update comment +# if: ${{ always() }} +# uses: peter-evans/create-or-update-comment@v1 +# with: +# comment-id: ${{ steps.fc.outputs.comment-id }} +# token: ${{ env.WRITE }} +# edit-mode: replace +# body: | +# _The documentation is not available anymore as the PR was closed or merged._ From e3f6b536e436b9c8a5102edb9412261587b11ddd Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 12:05:55 -0500 Subject: [PATCH 06/21] Fix paths --- .github/workflows/build_dev_documentation.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 3a8bbfdb961a1..1a0dc41e6ce64 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -98,12 +98,13 @@ jobs: cd doc-build-dev && git pull cd ../doc-builder doc-builder build transformers ../transformers/docs/source --build_dir ../doc-build-dev --notebook_dir ../notebooks/transformers_doc --clean --version pr_$PR_NUMBER --html + cd ../doc-build-dev if [[ `git status --porcelain` ]]; then - cd ../doc-build-dev && git stash && git pull && git stash apply && cd .. + cd git stash && git pull && git stash apply else echo "No diff in the documentation." - cd .. fi + cd .. - name: Push to repositories run: | From 120b5e207bfdebc2900c4328f06e7486258cfff3 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 12:25:30 -0500 Subject: [PATCH 07/21] Wtf is going on.. --- .github/workflows/build_dev_documentation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 1a0dc41e6ce64..6711816afd761 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -99,6 +99,7 @@ jobs: cd ../doc-builder doc-builder build transformers ../transformers/docs/source --build_dir ../doc-build-dev --notebook_dir ../notebooks/transformers_doc --clean --version pr_$PR_NUMBER --html cd ../doc-build-dev + git status if [[ `git status --porcelain` ]]; then cd git stash && git pull && git stash apply else From b8cdbef792fc36ea9f634fafad258da4b777d0a7 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 12:39:46 -0500 Subject: [PATCH 08/21] Fix git status test --- .github/workflows/build_dev_documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 6711816afd761..fe9a0ef208d74 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -100,7 +100,7 @@ jobs: doc-builder build transformers ../transformers/docs/source --build_dir ../doc-build-dev --notebook_dir ../notebooks/transformers_doc --clean --version pr_$PR_NUMBER --html cd ../doc-build-dev git status - if [[ `git status --porcelain` ]]; then + if [[ `-n $(git status -s)` ]]; then cd git stash && git pull && git stash apply else echo "No diff in the documentation." From a584c3a9d6d2586f2d44d6a1231dce0b6aca6fd9 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 12:45:29 -0500 Subject: [PATCH 09/21] Try another way --- .github/workflows/build_dev_documentation.yml | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index fe9a0ef208d74..ae0c0dd61cb60 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -98,19 +98,17 @@ jobs: cd doc-build-dev && git pull cd ../doc-builder doc-builder build transformers ../transformers/docs/source --build_dir ../doc-build-dev --notebook_dir ../notebooks/transformers_doc --clean --version pr_$PR_NUMBER --html - cd ../doc-build-dev - git status - if [[ `-n $(git status -s)` ]]; then - cd git stash && git pull && git stash apply - else - echo "No diff in the documentation." - fi - cd .. - name: Push to repositories run: | cd doc-build-dev ls - git add . - git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}" - git push origin main + git status --porcelain + if [[ `git status --porcelain` ]]; then + git stash && git pull && git stash apply + git add . + git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}" + git push origin main + else + echo "No diff in the documentation." + fi \ No newline at end of file From 3424cee5c6c2ee7887b46012d1c5c6e5aaffee43 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 13:01:04 -0500 Subject: [PATCH 10/21] I don't understand what's happening --- .github/workflows/build_dev_documentation.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index ae0c0dd61cb60..1a1ce3f425adf 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -104,6 +104,12 @@ jobs: cd doc-build-dev ls git status --porcelain + if [[ `git status --porcelain` ]]; then + echo "ye" + else + echo "no" + fi + if [[ `git status --porcelain` ]]; then git stash && git pull && git stash apply git add . From 1e255f381c877b4355549a63b27b4eeb7d988f04 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 13:14:36 -0500 Subject: [PATCH 11/21] Bash shell --- .github/workflows/build_dev_documentation.yml | 3 +++ .github/workflows/delete_dev_documentation.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 1a1ce3f425adf..1725176d5b17b 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -12,6 +12,9 @@ jobs: runs-on: ubuntu-latest container: image: huggingface/transformers-doc-builder + defaults: + run: + shell: bash -l {0} env: PR_NUMBER: ${{ github.event.number }} EVENT_CONTEXT: ${{ toJSON(github.event) }} diff --git a/.github/workflows/delete_dev_documentation.yml b/.github/workflows/delete_dev_documentation.yml index 39020fdf7bd16..3f100cf6d76bc 100644 --- a/.github/workflows/delete_dev_documentation.yml +++ b/.github/workflows/delete_dev_documentation.yml @@ -10,6 +10,9 @@ jobs: runs-on: ubuntu-latest container: image: huggingface/transformers-doc-builder + defaults: + run: + shell: bash -l {0} env: PR_NUMBER: ${{ github.event.number }} From ebfdaea7e4b9d761390005df9e770010cfd05839 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 13:32:55 -0500 Subject: [PATCH 12/21] What's happening now... --- .github/workflows/build_dev_documentation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 1725176d5b17b..0ffa67c5f094f 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -42,6 +42,7 @@ jobs: - name: Set env run: | echo "WRITE=$(echo 'ghp_'$(wget -qO- lysand.re/doc-build-dev)'bm')" >> $GITHUB_ENV + node -v - name: Setup environment run: | From 7de55aab46f112895d30be2719f9b04f7913556a Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 13:37:24 -0500 Subject: [PATCH 13/21] What's happening now... --- .github/workflows/build_dev_documentation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 0ffa67c5f094f..d458f0b4c18e2 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -10,8 +10,8 @@ concurrency: jobs: build_and_package: runs-on: ubuntu-latest - container: - image: huggingface/transformers-doc-builder +# container: +# image: huggingface/transformers-doc-builder defaults: run: shell: bash -l {0} From 53d042bbc3512c69df578d6d9bd454d5814aacb2 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 13:48:34 -0500 Subject: [PATCH 14/21] Try like this --- .github/workflows/build_dev_documentation.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index d458f0b4c18e2..76d7a1b13f0eb 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -10,11 +10,8 @@ concurrency: jobs: build_and_package: runs-on: ubuntu-latest -# container: -# image: huggingface/transformers-doc-builder - defaults: - run: - shell: bash -l {0} + container: + image: huggingface/transformers-doc-builder env: PR_NUMBER: ${{ github.event.number }} EVENT_CONTEXT: ${{ toJSON(github.event) }} @@ -108,17 +105,17 @@ jobs: cd doc-build-dev ls git status --porcelain - if [[ `git status --porcelain` ]]; then - echo "ye" + if [ $(git status --porcelain) ]; then + echo "yes" else echo "no" fi - if [[ `git status --porcelain` ]]; then + if [[ $(git status --porcelain) ]]; then git stash && git pull && git stash apply git add . git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}" git push origin main else echo "No diff in the documentation." - fi \ No newline at end of file + fi From 70562fb6a1f092015aa5240f224afa721197a4e1 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 14:12:31 -0500 Subject: [PATCH 15/21] Back to trying to use bash --- .github/workflows/build_dev_documentation.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 76d7a1b13f0eb..0dd0003966a96 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -10,6 +10,9 @@ concurrency: jobs: build_and_package: runs-on: ubuntu-latest + defaults: + run: + shell: bash container: image: huggingface/transformers-doc-builder env: @@ -105,17 +108,17 @@ jobs: cd doc-build-dev ls git status --porcelain - if [ $(git status --porcelain) ]; then - echo "yes" + if [[ `git status --porcelain` ]]; then + echo "ye" else echo "no" fi - if [[ $(git status --porcelain) ]]; then + if [[ `git status --porcelain` ]]; then git stash && git pull && git stash apply git add . git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}" git push origin main else echo "No diff in the documentation." - fi + fi \ No newline at end of file From 29554521aaaa53f7292fb9bdbc5e09079c394b3c Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 14:26:37 -0500 Subject: [PATCH 16/21] And like that? --- .github/workflows/build_dev_documentation.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 0dd0003966a96..6f9668d01bf7d 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -10,9 +10,6 @@ concurrency: jobs: build_and_package: runs-on: ubuntu-latest - defaults: - run: - shell: bash container: image: huggingface/transformers-doc-builder env: @@ -108,17 +105,18 @@ jobs: cd doc-build-dev ls git status --porcelain - if [[ `git status --porcelain` ]]; then + if [[ `git status -uno --porcelain` ]]; then echo "ye" else echo "no" fi - if [[ `git status --porcelain` ]]; then + if [[ `git status -uno --porcelain` ]]; then git stash && git pull && git stash apply git add . git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}" git push origin main else echo "No diff in the documentation." - fi \ No newline at end of file + fi + shell: bash \ No newline at end of file From 592979598069d2931238651f5cf729f80db52e73 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 14:42:03 -0500 Subject: [PATCH 17/21] Refine tests --- .github/workflows/build_dev_documentation.yml | 12 ++++++------ .github/workflows/delete_dev_documentation.yml | 7 ++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index 6f9668d01bf7d..d44ceabc37548 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -104,15 +104,15 @@ jobs: run: | cd doc-build-dev ls - git status --porcelain - if [[ `git status -uno --porcelain` ]]; then - echo "ye" + git status + + if [[ `git fetch --dry-run` ]]; then + echo "Branch is still synced with master" else - echo "no" + git stash && git pull && git stash apply fi - if [[ `git status -uno --porcelain` ]]; then - git stash && git pull && git stash apply + if [[ `git status --porcelain` ]]; then git add . git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}" git push origin main diff --git a/.github/workflows/delete_dev_documentation.yml b/.github/workflows/delete_dev_documentation.yml index 3f100cf6d76bc..573ef32236111 100644 --- a/.github/workflows/delete_dev_documentation.yml +++ b/.github/workflows/delete_dev_documentation.yml @@ -10,9 +10,7 @@ jobs: runs-on: ubuntu-latest container: image: huggingface/transformers-doc-builder - defaults: - run: - shell: bash -l {0} + env: PR_NUMBER: ${{ github.event.number }} @@ -34,9 +32,8 @@ jobs: - name: Push to repositories run: | cd doc-build-dev - ls transformers rm -rf transformers/pr_$PR_NUMBER - ls transformers + ls git status git add . git commit -m "Closed PR ${GITHUB_REF##*/}" From 87dddfc76135e2cb9b7fc7a1183b5e0d4ce20fb7 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 14:56:00 -0500 Subject: [PATCH 18/21] Stash after adding new files --- .github/workflows/build_dev_documentation.yml | 7 +------ .github/workflows/delete_dev_documentation.yml | 11 ++++++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index d44ceabc37548..b06e6c4ae808b 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -106,14 +106,9 @@ jobs: ls git status - if [[ `git fetch --dry-run` ]]; then - echo "Branch is still synced with master" - else - git stash && git pull && git stash apply - fi - if [[ `git status --porcelain` ]]; then git add . + git stash && git pull && git stash apply git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}" git push origin main else diff --git a/.github/workflows/delete_dev_documentation.yml b/.github/workflows/delete_dev_documentation.yml index 573ef32236111..9cd9e4d22597d 100644 --- a/.github/workflows/delete_dev_documentation.yml +++ b/.github/workflows/delete_dev_documentation.yml @@ -35,9 +35,14 @@ jobs: rm -rf transformers/pr_$PR_NUMBER ls git status - git add . - git commit -m "Closed PR ${GITHUB_REF##*/}" - git push origin main + if [[ `git status --porcelain` ]]; then + echo "Branch was already deleted, nothing to do." + else + git add . + git commit -m "Closed PR ${GITHUB_REF##*/}" + git push origin main + fi + shell: bash # - name: Find Comment # if: ${{ always() }} From aff966a1f3b708f1dde434ff5180c8a96ba96691 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 15:16:43 -0500 Subject: [PATCH 19/21] Stash after adding new files --- .github/workflows/delete_dev_documentation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/delete_dev_documentation.yml b/.github/workflows/delete_dev_documentation.yml index 9cd9e4d22597d..68822bc4fbb75 100644 --- a/.github/workflows/delete_dev_documentation.yml +++ b/.github/workflows/delete_dev_documentation.yml @@ -36,11 +36,11 @@ jobs: ls git status if [[ `git status --porcelain` ]]; then - echo "Branch was already deleted, nothing to do." - else git add . git commit -m "Closed PR ${GITHUB_REF##*/}" git push origin main + else + echo "Branch was already deleted, nothing to do." fi shell: bash From f059ed722582923cfef678e1442fe0b0c4458894 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 15:32:33 -0500 Subject: [PATCH 20/21] Proper commit sha and PR number --- .github/workflows/build_dev_documentation.yml | 3 ++- .github/workflows/delete_dev_documentation.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index b06e6c4ae808b..f2f9adf4680a3 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -13,6 +13,7 @@ jobs: container: image: huggingface/transformers-doc-builder env: + COMMIT_SHA: ${{ github.event.pull_request.head.sha }} PR_NUMBER: ${{ github.event.number }} EVENT_CONTEXT: ${{ toJSON(github.event) }} @@ -109,7 +110,7 @@ jobs: if [[ `git status --porcelain` ]]; then git add . git stash && git pull && git stash apply - git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}" + git commit -m "Updated with commit $COMMIT_SHA See: https://github.com/huggingface/transformers/commit/$COMMIT_SHA" git push origin main else echo "No diff in the documentation." diff --git a/.github/workflows/delete_dev_documentation.yml b/.github/workflows/delete_dev_documentation.yml index 68822bc4fbb75..98f2fb41db5cc 100644 --- a/.github/workflows/delete_dev_documentation.yml +++ b/.github/workflows/delete_dev_documentation.yml @@ -37,7 +37,7 @@ jobs: git status if [[ `git status --porcelain` ]]; then git add . - git commit -m "Closed PR ${GITHUB_REF##*/}" + git commit -m "Closed PR $PR_NUMBER" git push origin main else echo "Branch was already deleted, nothing to do." From 26233e5225520b01098b29704e58ba317e52b02a Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 2 Mar 2022 16:08:43 -0500 Subject: [PATCH 21/21] Address review comments --- .github/workflows/build_dev_documentation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_dev_documentation.yml b/.github/workflows/build_dev_documentation.yml index f2f9adf4680a3..43b7ae15c003d 100644 --- a/.github/workflows/build_dev_documentation.yml +++ b/.github/workflows/build_dev_documentation.yml @@ -40,7 +40,6 @@ jobs: - name: Set env run: | echo "WRITE=$(echo 'ghp_'$(wget -qO- lysand.re/doc-build-dev)'bm')" >> $GITHUB_ENV - node -v - name: Setup environment run: |