Skip to content

Merge pull request #7010 from ministryofjustice/jitbit-to-dev #647

Merge pull request #7010 from ministryofjustice/jitbit-to-dev

Merge pull request #7010 from ministryofjustice/jitbit-to-dev #647

name: New member environment files
on:
push:
paths:
- 'environments/**.json'
- 'environments-networks/**.json'
branches:
- main
workflow_dispatch:
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
create-and-commit-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: core-repo
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: ministryofjustice/modernisation-platform-environments
path: modernisation-platform-environments
persist-credentials: false
env:
TERRAFORM_GITHUB_TOKEN: ${{ secrets.TERRAFORM_GITHUB_TOKEN }}
- name: Provision member environment directories
run: bash ./core-repo/scripts/provision-member-directories.sh
- name: Commit changes to GitHub
run: bash ./core-repo/scripts/git-setup.sh ./modernisation-platform-environments
- run: bash ./core-repo/scripts/git-commit.sh . ./modernisation-platform-environments
env:
TERRAFORM_GITHUB_TOKEN: ${{ secrets.TERRAFORM_GITHUB_TOKEN }} # use this token as writing to a different repo
- run: bash ./core-repo/scripts/git-pull-request.sh terraform/environments ./modernisation-platform-environments
env:
TERRAFORM_GITHUB_TOKEN: ${{ secrets.TERRAFORM_GITHUB_TOKEN }}
- name: Slack failure notification
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
with:
payload: |
{"blocks":[{"type": "section","text": {"type": "mrkdwn","text": ":no_entry: Failed GitHub Action:"}},{"type": "section","fields":[{"type": "mrkdwn","text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"},{"type": "mrkdwn","text": "*Job:*\n${{ github.job }}"},{"type": "mrkdwn","text": "*Repo:*\n${{ github.repository }}"}]}]}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
if: ${{ failure() }}