diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index b0f09ab..27c283f 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -23,9 +23,11 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: CSVD/gh-actions-checkout@v3 with: github-server-url: https://github.e.it.census.gov + ref: ${{ github.head_ref }} + token: ${{ secrets.GH_TOKEN }} - uses: CSVD/gh-actions-setup-node@v3 @@ -36,15 +38,26 @@ jobs: with: terraform_version: ${{ vars.terraform_version }} + - name: Set output + id: vars + run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/} + - name: Terraform Format id: fmt run: | - terraform fmt -check + terraform fmt + if ! git diff-index --quiet HEAD; then + git config --global user.name '${{ vars.REPO_OWNER }}' + git config --global user.email '${{ vars.REPO_OWNER_EMAIL }}' + git commit -am "Autoformatting TF Code" + git push + echo "auto_format=true" >> $GITHUB_ENV + fi - name: Autoformat Halt if: env.auto_format == 'true' - run: exit 1 - + run: exit 0 + - name: Terraform Init id: init run: terraform init -upgrade