From 2029b2f40195790c0169ab8912611a1cd2c37d5a Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 28 Aug 2024 14:26:24 -0500 Subject: [PATCH] CLDR-17803 docs/site: fix merge to main - only update PR if there's a PR - Merge to main should update the production deployment --- .github/workflows/site.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 9336826c687..c57e4e049c5 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -39,15 +39,27 @@ jobs: - name: Pre-install Wrangler run: npm i -g wrangler@3.x # see https://github.com/cloudflare/wrangler-action/issues/286 + - name: Set the environment + id: chooser + run: | + echo ${{ github.event_name }} ${{ github.ref }} ; + if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref }}" == 'refs/heads/main' ]]; then + echo cenv=production >> $GITHUB_OUTPUT + echo prod + else + echo cenv=preview >> $GITHUB_OUTPUT + echo preview + fi - name: Deploy cldr.pages.dev id: deploy uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy ./_site --project-name=cldr + command: pages deploy ./_site --project-name=cldr --branch ${{ steps.chooser.outputs.cenv }} - name: Add deploy comment to PR uses: actions/github-script@v7 + if: github.event_name == 'pull_request' with: script: | github.rest.issues.createComment({