Add caching #144
Workflow file for this run
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
name: Deploy info | |
# If there is a PR from a fork which has been approved to run GitHub Actions, | |
# that PR's head is pushed to a branch directly in the repo (not the fork), | |
# so it's deployed by Cloudflare Pages as a branch preview. | |
on: | |
workflow_dispatch: | |
inputs: | |
simulate_fork_pr: | |
description: 'Simulate fork for this PR number' | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: write | |
deployments: write | |
pull-requests: read | |
jobs: | |
deploy-info: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
concurrency: | |
group: deploy-${{ github.event.inputs.simulate_fork_pr || github.event.number }} | |
environment: | |
name: deploy-${{ inputs.simulate_fork_pr || github.event.number }} | |
url: ${{ steps.get-url.outputs.url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Push to internal branch | |
if: > | |
inputs.simulate_fork_pr || | |
github.event.pull_request.head.repo.full_name != github.repository | |
run: | | |
git fetch origin ${{ github.sha }} | |
git push "https://user:${{ secrets.PUSH_GITHUB_TOKEN }}@github.com/${{ github.repository }}" ${{ github.sha }}:refs/heads/deploy/${{ inputs.simulate_fork_pr || github.event.number }} | |
- name: Get deploy URL | |
id: get-url | |
run: | | |
echo "url=https://${BRANCH_NAME//[\/.]/-}.dotnetinternals.pages.dev/" > "$GITHUB_OUTPUT" | |
env: | |
BRANCH_NAME: ${{ github.head_ref || format('deploy/{0}', inputs.simulate_fork_pr || github.event.number) }} |