name: 'Terragrunt format check'
on:
  - pull_request

permissions:
  contents: read

env:
  tofu_version: '1.10.0'
  tg_version: '0.77.22'

jobs:
  checks:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: 'Checkout'
        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
          persist-credentials: false

      - name: Check terragrunt HCL
        uses: gruntwork-io/terragrunt-action@95fc057922e3c3d4cc021a81a213f088f333ddef # v3.0.2
        with:
          tofu_version: ${{ env.tofu_version }}
          tg_version: ${{ env.tg_version }}
          tg_dir: 'deployment'
          tg_command: 'hclfmt --terragrunt-check --terragrunt-diff'
