namespace creation #22751
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: 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 | |
}) |