Skip to content

branch name

branch name #1

inputs:
terraform_version:
description: 'The version of Terraform to use'
required: false
default: '1.9.0'
type: string
workflow_dispatch:
jobs:
verify:
name: Check Terraform Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Setup Terraform
uses: hashicorp/[email protected]
with:
terraform_version: ${{ inputs.terraform_version }}
- name: Run Terraform fmt
run: terraform fmt -recursive
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git diff --quiet && git diff --staged --quiet || (git add -A && git commit -m "Apply terraform fmt")
- name: Push changes
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME=$(echo $GITHUB_REF | sed 's/refs\/heads\///')
git push origin HEAD:$BRANCH_NAME