Merge pull request #76153 from Expensify/arosiclair-revert-73676 #526
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy ExpensifyHelp | |
| on: | |
| # Run on any push to main that has changes to the docs directory | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'docs/**' | |
| # Run on any pull request (except PRs against staging or production) that has changes to the docs directory | |
| pull_request: | |
| types: [opened, synchronize] | |
| branches-ignore: [staging, production] | |
| paths: | |
| - 'docs/**' | |
| # Run on any manual trigger | |
| workflow_dispatch: | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| env: | |
| IS_PR_FROM_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }} | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - name: Checkout | |
| # v4 | |
| uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install pcregrep | |
| run: sudo apt-get install -y pcregrep | |
| - name: Setup NodeJS | |
| uses: ./.github/actions/composite/setupNode | |
| - name: Create docs routes file | |
| run: ./.github/scripts/createDocsRoutes.sh | |
| - name: Check for duplicates and cycles in redirects.csv | |
| run: ./.github/scripts/verifyRedirect.sh | |
| - name: Enforce that a redirect link has been created | |
| run: ./.github/scripts/enforceRedirect.sh | |
| - name: Enforce iframe and Cloudflare CDN usage | |
| run: ./.github/scripts/enforceVideoFormats.sh | |
| - name: Build with Jekyll | |
| uses: actions/jekyll-build-pages@0143c158f4fa0c5dcd99499a5d00859d79f70b0e | |
| with: | |
| source: ./docs/ | |
| destination: ./docs/_site | |
| - name: Deploy to Cloudflare Pages | |
| uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca | |
| id: deploy | |
| if: env.IS_PR_FROM_FORK != 'true' | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| projectName: helpdot | |
| directory: ./docs/_site | |
| - name: Setup Cloudflare CLI | |
| if: env.IS_PR_FROM_FORK != 'true' | |
| run: pip3 install cloudflare==2.19.0 | |
| - name: Purge Cloudflare cache | |
| if: env.IS_PR_FROM_FORK != 'true' | |
| run: /home/runner/.local/bin/cli4 --verbose --delete hosts=["help.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache | |
| env: | |
| CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }} | |
| - name: Check if only articles are updated | |
| if: ${{ github.event_name == 'pull_request' }} | |
| id: verify_articles_only_updated | |
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
| with: | |
| filters: | | |
| articles: | |
| - 'docs/articles/**' | |
| - 'docs/**/*.csv' | |
| - name: Ensure PR title has [No QA] prefix | |
| if: ${{ github.event_name == 'pull_request' && env.IS_PR_FROM_FORK != 'true' && steps.verify_articles_only_updated.outputs.articles == 'true' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| current_title=$(gh pr view "$PR_NUMBER" --repo "$REPO" --json title -q '.title') | |
| if [[ "$current_title" == "[No QA]"* ]]; then | |
| echo "PR title already contains [No QA]; skipping." | |
| exit 0 | |
| fi | |
| gh pr edit "$PR_NUMBER" --repo "$REPO" --title "[No QA] $current_title" | |
| - name: Generate ExpensifyHelp preview comment | |
| id: preview_comment | |
| if: ${{ github.event_name == 'pull_request' && env.IS_PR_FROM_FORK != 'true' }} | |
| uses: ./.github/actions/javascript/generateHelpPreviewComment | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ROOT_URL: ${{ steps.deploy.outputs.alias }} | |
| PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | |
| - name: Leave a comment on the PR | |
| uses: actions-cool/maintain-one-comment@de04bd2a3750d86b324829a3ff34d47e48e16f4b | |
| if: ${{ github.event_name == 'pull_request' && env.IS_PR_FROM_FORK != 'true' }} | |
| with: | |
| token: ${{ secrets.OS_BOTIFY_TOKEN }} | |
| body: ${{ steps.preview_comment.outputs.BODY }} |