Split tf code #2
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| shellcheck: | |
| name: ShellCheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run ShellCheck | |
| uses: ludeeus/action-shellcheck@master | |
| with: | |
| scandir: './scripts' | |
| severity: warning | |
| terraform-validation: | |
| name: Terraform Validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| - name: Terraform Format Check | |
| id: fmt | |
| run: terraform fmt -check -recursive terraform_code/ | |
| continue-on-error: true | |
| - name: Create mock provider.tf | |
| run: | | |
| cat > terraform_code/provider.tf << 'EOF' | |
| terraform { | |
| required_providers { | |
| aws = { | |
| source = "hashicorp/aws" | |
| version = "~> 4.30" | |
| } | |
| random = { | |
| source = "hashicorp/random" | |
| version = ">= 2.2" | |
| } | |
| } | |
| } | |
| provider "aws" { | |
| region = "us-east-1" | |
| skip_credentials_validation = true | |
| skip_requesting_account_id = true | |
| skip_metadata_api_check = true | |
| } | |
| EOF | |
| - name: Create mock terraform.tfvars | |
| run: | | |
| cat > terraform_code/terraform.tfvars << 'EOF' | |
| aws_resource_identifier = "test-repo-branch" | |
| aws_resource_identifier_supershort = "test-repo-branch" | |
| aws_tf_state_bucket = "test-bucket" | |
| aws_site_source_folder = "/tmp/test" | |
| app_repo_name = "test-repo" | |
| app_org_name = "test-org" | |
| app_branch_name = "test-branch" | |
| EOF | |
| - name: Terraform Init | |
| id: init | |
| run: terraform -chdir=terraform_code init -backend=false | |
| - name: Terraform Validate | |
| id: validate | |
| run: terraform -chdir=terraform_code validate | |
| - name: Comment Format Check Result | |
| if: always() && steps.fmt.outcome == 'failure' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '⚠️ Terraform formatting issues detected. Run `terraform fmt -recursive terraform_code/` to fix.' | |
| }) | |
| markdown-lint: | |
| name: Markdown Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Markdown Lint | |
| uses: DavidAnson/markdownlint-cli2-action@v15 | |
| with: | |
| globs: '**/*.md' |