removing locals and ref's blocks to repository names, the rulesets will be based of the custom propertys > rulesets #88
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: Terraform Pre-Check | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
pre-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Checkout cnp-azuredevops-libraries | |
uses: actions/checkout@v4 | |
with: | |
repository: hmcts/cnp-azuredevops-libraries | |
path: cnp-azuredevops-libraries | |
- name: Make Terraform Setup Script Executable | |
run: chmod +x cnp-azuredevops-libraries/scripts/tfenv-install-terraform.sh | |
- name: Setup Terraform | |
run: ./cnp-azuredevops-libraries/scripts/tfenv-install-terraform.sh | |
shell: bash | |
- name: Terraform Format | |
run: terraform fmt -recursive | |
working-directory: components | |
- name: Commit and Push Changes | |
working-directory: components | |
run: | | |
git config --global user.email "hmcts-platform-operations@HMCTS.NET" | |
git config --global user.name "hmcts-platform-operations" | |
git add -u | |
git diff-index --quiet HEAD || git commit -m "Format with terraform fmt" | |
git push origin HEAD:${{ github.head_ref }} || echo "No changes to push" |