Slight updates from review #2
This file contains 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
on: | ||
# Run on any push to main that has changes to the help directory | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'help/**' | ||
# 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: | ||
- 'help/**' | ||
# 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: "newhelp" | ||
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 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build with Jekyll | ||
uses: actions/jekyll-build-pages@v1.0.13 # Using the latest stable version | ||
with: | ||
source: ./help/ | ||
destination: ./help/_site | ||
- name: Deploy to Cloudflare Pages | ||
uses: cloudflare/pages-action@v1 # Using the latest stable version | ||
id: deploy | ||
if: env.IS_PR_FROM_FORK != 'true' | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
projectName: newhelp | ||
directory: ./help/_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/.local/bin/cli4" --verbose --delete hosts=["newhelp.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache | ||
env: | ||
CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }} | ||
- name: Leave a comment on the PR | ||
uses: actions-cool/maintain-one-comment@v3.2.0 # Using the latest stable version | ||
if: ${{ github.event_name == 'pull_request' && env.IS_PR_FROM_FORK != 'true' }} | ||
with: | ||
token: ${{ secrets.OS_BOTIFY_TOKEN }} | ||
body: ${{ format('A preview of your New Help changes have been deployed to {0} :zap:️', steps.deploy.outputs.alias) }} | ||