👷 Refactor GitHub Action to comment docs deployment URLs and update token (#11925)

This commit is contained in:
Sebastián Ramírez
2024-07-31 18:40:04 -05:00
committed by GitHub
parent c0ae16ab7a
commit 8b930f8847
6 changed files with 52 additions and 97 deletions

View File

@@ -5,9 +5,11 @@ on:
- Build Docs
types:
- completed
permissions:
deployments: write
issues: write
pull-requests: write
jobs:
deploy-docs:
@@ -41,9 +43,22 @@ jobs:
directory: './site'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ ( github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == 'master' && 'main' ) || ( github.event.workflow_run.head_sha ) }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-github-actions-${{ env.pythonLocation }}-${{ hashFiles('requirements-github-actions.txt') }}-v01
- name: Install GitHub Actions dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install -r requirements-github-actions.txt
- name: Comment Deploy
if: steps.deploy.outputs.url != ''
uses: ./.github/actions/comment-docs-preview-in-pr
with:
token: ${{ secrets.GITHUB_TOKEN }}
deploy_url: "${{ steps.deploy.outputs.url }}"
run: python ./scripts/comment_docs_deploy_url_in_pr.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEPLOY_URL: ${{ steps.deploy.outputs.url }}
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}