Skip to content

namespace creation #22751

namespace creation

namespace creation #22751

name: Compare Respository Namespace with Terraform Resource Namespace
on:
pull_request:
paths:
- 'namespaces/live.cloud-platform.service.justice.gov.uk/**'
- 'namespaces/live-2.cloud-platform.service.justice.gov.uk/**'
workflow_dispatch:
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
compare-namespaces:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: compare-namespace
name: Check Cross Namespace Deployments
uses: ministryofjustice/cloud-platform-environments/cmd/compare-namespace@main
- name: Comment Mismatch to Pull Request
uses: actions/github-script@v7
if: steps.compare-namespace.outputs.mismatch == 'true'
env:
RESULT: "Please review the following:\n${{ steps.compare-namespace.outputs.result }}"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const output = `#### Namespace Mismatch Found:
<details><summary>Show</summary>
\`\`\`${process.env.RESULT}\`\`\`
</details>
*Pusher: @${{ github.actor }}, Workflow: \`${{ github.workflow }}\`*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})