mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-05 13:50:13 +06:00
Update delete-dev-doc job to match build-dev-doc (#15891)
* Update delete-dev-doc job to match build-dev-doc * More debug info * More debug info * Stash if needed * Remove the comment update * Fix paths * Wtf is going on.. * Fix git status test * Try another way * I don't understand what's happening * Bash shell * What's happening now... * What's happening now... * Try like this * Back to trying to use bash * And like that? * Refine tests * Stash after adding new files * Stash after adding new files * Proper commit sha and PR number * Address review comments
This commit is contained in:
parent
89be34c36c
commit
3d2242869d
43
.github/workflows/build_dev_documentation.yml
vendored
43
.github/workflows/build_dev_documentation.yml
vendored
@ -13,6 +13,7 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: huggingface/transformers-doc-builder
|
image: huggingface/transformers-doc-builder
|
||||||
env:
|
env:
|
||||||
|
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
|
||||||
PR_NUMBER: ${{ github.event.number }}
|
PR_NUMBER: ${{ github.event.number }}
|
||||||
EVENT_CONTEXT: ${{ toJSON(github.event) }}
|
EVENT_CONTEXT: ${{ toJSON(github.event) }}
|
||||||
|
|
||||||
@ -73,23 +74,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.'
|
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 }}
|
GITHUB_TOKEN: ${{ env.WRITE }}
|
||||||
|
|
||||||
- name: Find Comment
|
# - name: Find Comment
|
||||||
if: github.event.action == 'reopened'
|
# if: github.event.action == 'reopened'
|
||||||
uses: peter-evans/find-comment@v1
|
# uses: peter-evans/find-comment@v1
|
||||||
id: fc
|
# id: fc
|
||||||
with:
|
# with:
|
||||||
issue-number: ${{ env.PR_NUMBER }}
|
# issue-number: ${{ env.PR_NUMBER }}
|
||||||
comment-author: HuggingFaceDocBuilder
|
# comment-author: HuggingFaceDocBuilder
|
||||||
|
|
||||||
- name: Update comment
|
# - name: Update comment
|
||||||
if: github.event.action == 'reopened'
|
# if: github.event.action == 'reopened'
|
||||||
uses: peter-evans/create-or-update-comment@v1
|
# uses: peter-evans/create-or-update-comment@v1
|
||||||
with:
|
# with:
|
||||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
# comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||||
token: ${{ env.WRITE }}
|
# token: ${{ env.WRITE }}
|
||||||
edit-mode: replace
|
# edit-mode: replace
|
||||||
body: |
|
# 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.
|
# 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
|
- name: Make documentation
|
||||||
env:
|
env:
|
||||||
@ -103,6 +104,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd doc-build-dev
|
cd doc-build-dev
|
||||||
ls
|
ls
|
||||||
|
git status
|
||||||
|
|
||||||
|
if [[ `git status --porcelain` ]]; then
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}"
|
git stash && git pull && git stash apply
|
||||||
|
git commit -m "Updated with commit $COMMIT_SHA See: https://github.com/huggingface/transformers/commit/$COMMIT_SHA"
|
||||||
git push origin main
|
git push origin main
|
||||||
|
else
|
||||||
|
echo "No diff in the documentation."
|
||||||
|
fi
|
||||||
|
shell: bash
|
60
.github/workflows/delete_dev_documentation.yml
vendored
60
.github/workflows/delete_dev_documentation.yml
vendored
@ -7,23 +7,22 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_package:
|
build_and_package:
|
||||||
runs-on: [self-hosted, doc-builder]
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: huggingface/doc-builder-transformers
|
image: huggingface/transformers-doc-builder
|
||||||
options: "-v /home/github_actions:/mnt"
|
|
||||||
env:
|
env:
|
||||||
PR_NUMBER: ${{ github.event.number }}
|
PR_NUMBER: ${{ github.event.number }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set env
|
- name: Set env
|
||||||
run: echo "WRITE=$(cat /mnt/WRITE)" >> $GITHUB_ENV
|
run: |
|
||||||
|
echo "WRITE=$(echo 'ghp_'$(wget -qO- lysand.re/doc-build-dev)'bm')" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- name: Setup environment
|
||||||
with:
|
run: |
|
||||||
repository: 'huggingface/doc-build-dev'
|
rm -rf doc-build-dev
|
||||||
path: doc-build-dev
|
git clone --depth 1 https://HuggingFaceDocBuilderDev:${{ env.WRITE }}@github.com/huggingface/doc-build-dev
|
||||||
token: ${{ env.WRITE }}
|
|
||||||
|
|
||||||
- name: Setup git
|
- name: Setup git
|
||||||
run: |
|
run: |
|
||||||
@ -33,27 +32,32 @@ jobs:
|
|||||||
- name: Push to repositories
|
- name: Push to repositories
|
||||||
run: |
|
run: |
|
||||||
cd doc-build-dev
|
cd doc-build-dev
|
||||||
ls
|
|
||||||
rm -rf transformers/pr_$PR_NUMBER
|
rm -rf transformers/pr_$PR_NUMBER
|
||||||
ls
|
ls
|
||||||
|
git status
|
||||||
|
if [[ `git status --porcelain` ]]; then
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Closed PR ${GITHUB_REF##*/}"
|
git commit -m "Closed PR $PR_NUMBER"
|
||||||
git push origin main
|
git push origin main
|
||||||
|
else
|
||||||
|
echo "Branch was already deleted, nothing to do."
|
||||||
|
fi
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Find Comment
|
# - name: Find Comment
|
||||||
if: ${{ always() }}
|
# if: ${{ always() }}
|
||||||
uses: peter-evans/find-comment@v1
|
# uses: peter-evans/find-comment@v1
|
||||||
id: fc
|
# id: fc
|
||||||
with:
|
# with:
|
||||||
issue-number: ${{ env.PR_NUMBER }}
|
# issue-number: ${{ env.PR_NUMBER }}
|
||||||
comment-author: HuggingFaceDocBuilder
|
# comment-author: HuggingFaceDocBuilder
|
||||||
|
|
||||||
- name: Update comment
|
# - name: Update comment
|
||||||
if: ${{ always() }}
|
# if: ${{ always() }}
|
||||||
uses: peter-evans/create-or-update-comment@v1
|
# uses: peter-evans/create-or-update-comment@v1
|
||||||
with:
|
# with:
|
||||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
# comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||||
token: ${{ env.WRITE }}
|
# token: ${{ env.WRITE }}
|
||||||
edit-mode: replace
|
# edit-mode: replace
|
||||||
body: |
|
# body: |
|
||||||
_The documentation is not available anymore as the PR was closed or merged._
|
# _The documentation is not available anymore as the PR was closed or merged._
|
||||||
|
Loading…
Reference in New Issue
Block a user