Update lint-docs-source-page.sh #51
Workflow file for this run
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
| # Copyright 2026 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: "CF: Deploy PR Preview" | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| deploy-preview: | |
| if: > | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success') | |
| runs-on: ubuntu-24.04 | |
| concurrency: | |
| group: "cf-deploy-${{ github.event.inputs.pr_number || github.event.workflow_run.pull_requests[0].number }}" | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout base repository | |
| uses: actions/checkout@v4 | |
| - name: Download Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: cf-preview-data | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.inputs.build_run_id || github.event.workflow_run.id }} | |
| path: downloaded-artifact | |
| - name: Read PR Number | |
| id: get_pr | |
| run: | | |
| if [ -n "${{ github.event.inputs.pr_number }}" ]; then | |
| PR_NUMBER="${{ github.event.inputs.pr_number }}" | |
| else | |
| PR_NUMBER=$(cat downloaded-artifact/pr_number.txt) | |
| fi | |
| echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT" | |
| - name: Deploy to Cloudflare Pages | |
| id: cf_deploy | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy downloaded-artifact/public --project-name toolbox-docs --branch pr-${{ steps.get_pr.outputs.pr_number }} | |
| - name: Comment | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| script: | | |
| const prNumber = parseInt('${{ steps.get_pr.outputs.pr_number }}', 10); | |
| const deployUrl = '${{ steps.cf_deploy.outputs.pages-deployment-alias-url }}'; | |
| await github.rest.issues.createComment({ | |
| issue_number: prNumber, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `🚀 **Cloudflare Preview Ready!**\n\n🔎 View Preview: ${deployUrl}\n\n*(Note: It may take a minute or two for Cloudflare to finish deploying the branch)*` | |
| }); |