name: "Review App: Deploy" concurrency: group: review-${{ github.event.pull_request.number }} on: pull_request: types: - synchronize - reopened - labeled workflow_dispatch: defaults: run: shell: bash jobs: infra: name: Deploy review app infrastructure if: contains(github.event.pull_request.labels.*.name, 'review-app') uses: communitiesuk/submit-social-housing-lettings-and-sales-data-infrastructure/.github/workflows/create_review_app_infra.yml@main with: key: ${{ github.event.pull_request.number }} app_repo_role: arn:aws:iam::815624722760:role/core-application-repo permissions: id-token: write code: name: Deploy review app code if: contains(github.event.pull_request.labels.*.name, 'review-app') needs: [infra] uses: ./.github/workflows/aws_deploy.yml with: aws_account_id: 837698168072 aws_role_prefix: core-dev aws_task_prefix: core-review-${{ github.event.pull_request.number }} concurrency_tag: ${{ github.event.pull_request.number }} environment: review permissions: id-token: write comment: name: Add link to PR if: contains(github.event.pull_request.labels.*.name, 'review-app') needs: [code] runs-on: ubuntu-latest permissions: issues: write pull-requests: write steps: - name: Comment on PR with URL uses: actions/github-script@v7 with: script: | const prNumber = context.issue.number; const msg = `Created review app at https://review.submit-social-housing-data.communities.gov.uk/${prNumber}. Note that the review app will be automatically deprovisioned after 30 days and will need the review app pipeline running again.`; const { data: comments } = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber, }); if (!comments.find(c => c.body.startsWith('Created review app at'))) { await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber, body: msg, }); }