Skip to content

Commit

Permalink
Fix GitHub Actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRoma committed Feb 6, 2025
1 parent 89f07bf commit ff258e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 60 deletions.
60 changes: 2 additions & 58 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ name: terraform

on:
push:
# branches:
# - master
pull_request:

jobs:
Expand All @@ -14,67 +12,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: terraform setup
uses: hashicorp/setup-terraform@v1
# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

# TODO: This step duplicates work done by the Makefile.
# - name: check terraform formatting
# id: fmt
# run: |
# terraform fmt -check -recursive
uses: hashicorp/setup-terraform@v3

- name: run make
# env:
# TOKEN: ${{ secrets.TOKEN }}
run: |
make all
# - name: terraform init
# id: init
# run: terraform init
#
# - name: terraform plan
# id: plan
# if: github.event_name == 'pull_request'
# run: terraform plan -no-color
# continue-on-error: true
#
# - uses: actions/github-script@0.9.0
# if: github.event_name == 'pull_request'
# env:
# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# script: |
# const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
# #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
# #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
#
# <details><summary>Show Plan</summary>
#
# \`\`\`${process.env.PLAN}\`\`\`
#
# </details>
#
# *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
#
#
# github.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: output
# })
#
# - name: terraform plan status
# if: steps.plan.outcome == 'failure'
# run: exit 1
#
# - name: terraform apply
# if: github.ref == 'refs/heads/master' && github.event_name == 'push'
# run: terraform apply -auto-approve
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ REPO := $(shell basename $(shell git remote get-url origin) .git)
all: test

test: .terraform
AWS_DEFAULT_REGION=us-east-2 terraform validate
terraform init -backend=false
terraform validate
terraform fmt -check
! egrep "TF-UPGRADE-TODO|cites-illinois|as-aws-modules" *.tf README.md
# Do NOT put terraform-aws in the title
Expand All @@ -23,11 +24,13 @@ test: .terraform
# DO put a badge in top-level README.md
grep -q "\[\!\[Terraform actions status\]([^)]*$(REPO)/workflows/terraform/badge.svg)\]([^)]*$(REPO)/actions)" README.md
# Do NOT use ?ref= in source lines in a README.md!
! grep 'source\s*=.*?ref=' README.md
! grep 'source\s*=.*?ref=' *.tf README.md
# Do NOT start a source line with git::
! grep 'source\s*=\s*"git::' *.tf README.md
# Do NOT use .git in a source line
! grep 'source\s*=.*\.git.*"' *.tf README.md
@echo ""
@echo "tests passed"

# Launches the Makefile inside a container
docker:
Expand Down

0 comments on commit ff258e3

Please sign in to comment.