mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-04 05:10:06 +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
47
.github/workflows/build_dev_documentation.yml
vendored
47
.github/workflows/build_dev_documentation.yml
vendored
@ -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) }}
|
||||
|
||||
@ -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.'
|
||||
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: 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: 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:
|
||||
@ -103,6 +104,14 @@ jobs:
|
||||
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
|
||||
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
git add .
|
||||
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
|
||||
else
|
||||
echo "No diff in the documentation."
|
||||
fi
|
||||
shell: bash
|
66
.github/workflows/delete_dev_documentation.yml
vendored
66
.github/workflows/delete_dev_documentation.yml
vendored
@ -7,23 +7,22 @@ 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: |
|
||||
@ -33,27 +32,32 @@ jobs:
|
||||
- name: Push to repositories
|
||||
run: |
|
||||
cd doc-build-dev
|
||||
ls
|
||||
rm -rf transformers/pr_$PR_NUMBER
|
||||
ls
|
||||
git add .
|
||||
git commit -m "Closed PR ${GITHUB_REF##*/}"
|
||||
git push origin main
|
||||
git status
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
git add .
|
||||
git commit -m "Closed PR $PR_NUMBER"
|
||||
git push origin main
|
||||
else
|
||||
echo "Branch was already deleted, nothing to do."
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Find Comment
|
||||
if: ${{ always() }}
|
||||
uses: peter-evans/find-comment@v1
|
||||
id: fc
|
||||
with:
|
||||
issue-number: ${{ env.PR_NUMBER }}
|
||||
comment-author: HuggingFaceDocBuilder
|
||||
# - 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: 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._
|
||||
|
Loading…
Reference in New Issue
Block a user