♻️ Refactor Deploy Docs GitHub Action to be a script and update token preparing for org (#1039)

This commit is contained in:
Sebastián Ramírez
2024-07-31 19:05:06 -05:00
committed by GitHub
parent d7af50c184
commit 77374aa016
6 changed files with 57 additions and 92 deletions

View File

@@ -6,6 +6,11 @@ on:
types:
- completed
permissions:
deployments: write
issues: write
pull-requests: write
jobs:
deploy-docs:
runs-on: ubuntu-latest
@@ -38,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 == 'main' && '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 }}