---
name: enos_fmt

on:
  pull_request:
    paths:
      - enos/**

permissions:
  contents: read

jobs:
  fmt_check:
    # Only run this workflow on pull requests from hashicorp/boundary branches
    # as we need secrets to install enos.
    if: github.event.pull_request.head.repo.fork != 'true'
    runs-on: ${{ fromJSON(vars.RUNNER) }}
    env:
      GITHUB_TOKEN: ${{ secrets.SERVICE_USER_GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd    # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed
        with:
          terraform_wrapper: false
      - uses: hashicorp/action-setup-enos@v1    # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed
        with:
          github-token: ${{ secrets.SERVICE_USER_GITHUB_TOKEN }}
      - name: "check formatting"
        working-directory: ./enos
        run: make check-fmt
