Update merge-main-into-prs.yml (#16199)
This commit is contained in:
parent
e97782943b
commit
1210b49cd2
2 changed files with 5 additions and 11 deletions
9
.github/workflows/docs.yml
vendored
9
.github/workflows/docs.yml
vendored
|
|
@ -17,7 +17,7 @@ name: Publish Docs
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request_target:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
|
|
@ -81,21 +81,18 @@ jobs:
|
|||
fi
|
||||
- name: Publish Docs to https://docs.ultralytics.com
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY_DOCS }}
|
||||
run: |
|
||||
git clone https://github.com/ultralytics/docs.git docs-repo
|
||||
cd docs-repo
|
||||
git checkout gh-pages || git checkout -b gh-pages
|
||||
rm -rf *
|
||||
cp -R ../site/* .
|
||||
echo "$INDEXNOW_KEY" > "$INDEXNOW_KEY.txt"
|
||||
echo "${{ secrets.INDEXNOW_KEY_DOCS }}" > "${{ secrets.INDEXNOW_KEY_DOCS }}.txt"
|
||||
git add .
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
LATEST_HASH=$(git rev-parse --short=7 HEAD)
|
||||
git commit -m "Update Docs for 'ultralytics ${{ steps.check_pypi.outputs.version }} - $LATEST_HASH'"
|
||||
git push https://$PERSONAL_ACCESS_TOKEN@github.com/ultralytics/docs.git gh-pages
|
||||
git push https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/ultralytics/docs.git gh-pages
|
||||
fi
|
||||
|
|
|
|||
7
.github/workflows/merge-main-into-prs.yml
vendored
7
.github/workflows/merge-main-into-prs.yml
vendored
|
|
@ -33,8 +33,8 @@ jobs:
|
|||
import os
|
||||
import time
|
||||
|
||||
g = Github(os.getenv('GITHUB_TOKEN'))
|
||||
repo = g.get_repo(os.getenv('GITHUB_REPOSITORY'))
|
||||
g = Github("${{ secrets.PERSONAL_ACCESS_TOKEN }}")
|
||||
repo = g.get_repo("${{ github.repository }}")
|
||||
|
||||
# Fetch the default branch name
|
||||
default_branch_name = repo.default_branch
|
||||
|
|
@ -86,6 +86,3 @@ jobs:
|
|||
print(f"Branches already up-to-date: {up_to_date_branches}")
|
||||
print(f"Total errors: {errors}")
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue