Skip to content

Running pull request flow for feature/comment-in-pr-with-fqdn #58

Running pull request flow for feature/comment-in-pr-with-fqdn

Running pull request flow for feature/comment-in-pr-with-fqdn #58

Workflow file for this run

name: Pull request workflow
run-name: Running pull request flow for ${{ github.head_ref }}
concurrency: pull-request-${{ github.ref_name }}
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, closed]
permissions:
id-token: write
contents: read
pull-requests: write
jobs:
create-subdomain-hash:
name: Create a deterministic subdomain hash based on the branch name
runs-on: ubuntu-latest
outputs:
subdomainHash: ${{ steps.generateHash.outputs.hash }}
steps:
- id: generateHash
run: |
branch_hash=($(sha1sum <<< ${{ github.head_ref }} | rev | cut -c 32- | rev))
echo -n "hash=$branch_hash" >> "$GITHUB_OUTPUT"
apply-pull-request-infrastructure:
uses: ./.github/workflows/reusable-apply-infrastructure.yaml
with:
suffix: ${{ github.head_ref }}
environment: preview
cloudSubDomain: ${{ needs.create-subdomain-hash.outputs.subdomainHash }}.cloud
dotnetSubDomain: ${{ needs.create-subdomain-hash.outputs.subdomainHash }}.dotnet
needs: [create-subdomain-hash]
secrets: inherit
build-cloud-application:
if: github.event.action != 'closed'
uses: ./.github/workflows/reusable-build-application.yaml
with:
application: cloud
needs: [apply-pull-request-infrastructure]
deploy-cloud-application:
if: github.event.action != 'closed'
uses: ./.github/workflows/reusable-deploy-application.yaml
with:
application: cloud
storageAccount: ${{ needs.apply-pull-request-infrastructure.outputs.cloudStorageAccount }}
resourceGroup: ${{ needs.apply-pull-request-infrastructure.outputs.resourceGroup }}
environment: preview
needs: [apply-pull-request-infrastructure, build-cloud-application]
secrets: inherit
build-dotnet-application:
if: github.event.action != 'closed'
uses: ./.github/workflows/reusable-build-application.yaml
with:
application: dotnet
needs: [apply-pull-request-infrastructure]
deploy-dotnet-application:
if: github.event.action != 'closed'
uses: ./.github/workflows/reusable-deploy-application.yaml
with:
application: dotnet
storageAccount: ${{ needs.apply-pull-request-infrastructure.outputs.dotnetStorageAccount }}
resourceGroup: ${{ needs.apply-pull-request-infrastructure.outputs.resourceGroup }}
environment: preview
needs: [apply-pull-request-infrastructure, build-dotnet-application]
secrets: inherit
remove-infrastructure:
if: github.event.action == 'closed'
uses: ./.github/workflows/reusable-destroy-infrastructure.yaml
with:
environment: preview
resourcegroup: ${{ needs.apply-pull-request-infrastructure.outputs.resourceGroup }}
needs: [apply-pull-request-infrastructure]
secrets: inherit