From 53266c7b5fa2981680b912ff0b991303e27d3ef3 Mon Sep 17 00:00:00 2001 From: Tristan Watson Date: Thu, 8 Aug 2024 15:59:07 +0100 Subject: [PATCH] fix(actions, docs): Fixing action to be action - not workflow syntax, improving docs, removing versioning as this is done via setup --- .github/{workflows => workflows/yaml-lint.yml} | 2 +- README.md | 18 +++++++++++------- .../{terraform => terraform-checks}/action.yml | 11 ++--------- examples/define-version/action.yml | 12 ------------ examples/general-use/README.md | 2 +- .../{action.yml => terraform-checks.yml} | 9 +++++---- 6 files changed, 20 insertions(+), 34 deletions(-) rename .github/{workflows => workflows/yaml-lint.yml} (92%) rename actions/{terraform => terraform-checks}/action.yml (78%) delete mode 100644 examples/define-version/action.yml rename examples/general-use/{action.yml => terraform-checks.yml} (56%) diff --git a/.github/workflows b/.github/workflows/yaml-lint.yml similarity index 92% rename from .github/workflows rename to .github/workflows/yaml-lint.yml index f2ea17e..ea0464d 100644 --- a/.github/workflows +++ b/.github/workflows/yaml-lint.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v2 diff --git a/README.md b/README.md index f206178..6edfee1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # oak-terraform-actions -The `actions` folder is designed to house reusable GitHub Actions, making it easy to manage and share automation across different repositories. Each subfolder within `actions` contains a specific action with all necessary files and documentation. +The `actions` folder is designed to house reusable GitHub Actions for **Terraform**, making it easy to manage and share automation across different repositories. See the Example folder to get started. #### Structure ```plaintext actions/ -├── terraform/ +├── terraform-checks/ │ ├── action.yml │ ├── scripts/ (if any) │ └── README.md @@ -14,20 +14,22 @@ actions/ ### Terraform Actions 🌍 -**Location:** `actions/terraform` +#### Terraform Checks -**Purpose:** The Terraform action automates Terraform workflows, including applying infrastructure as code configurations. +**Location:** `actions/terraform-checks` + +**Purpose:** The Terraform Github Action checks your code fits the Oak standards. #### Key Features - **Infrastructure Management:** Streamlines Terraform commands in CI/CD pipelines. - **Ease of Use:** Integrates seamlessly with your GitHub workflows. -- **Customizable:** Accepts input parameters for flexible operation. ### How to Use ```yaml -name: Terraform Check +# Example Github Workflow file to run Terraform Check action +name: Terraform Checks on: [push, pull_request] @@ -36,8 +38,10 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v4 - name: Run Terraform Action from oak-terraform-actions - uses: oaknational/oak-terraform-actions/actions/terraform@main + uses: oaknational/oak-terrform-actions/actions/terraform-checks@main ``` For more details, visit the [Oak Terraform Actions repository](https://github.com/oaknational/oak-terraform-actions). diff --git a/actions/terraform/action.yml b/actions/terraform-checks/action.yml similarity index 78% rename from actions/terraform/action.yml rename to actions/terraform-checks/action.yml index f5d040a..196d43f 100644 --- a/actions/terraform/action.yml +++ b/actions/terraform-checks/action.yml @@ -1,18 +1,11 @@ name: "Terraform Checks" description: "Perform common Terraform checks" -inputs: - terraform_version: - description: "Terraform version to use" - required: false - default: "1.5.7" + runs: using: "composite" steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Setup Terraform - uses: hashicorp/setup-terraform@v2 + uses: hashicorp/setup-terraform@v3 with: terraform_version: ${{ inputs.terraform_version }} diff --git a/examples/define-version/action.yml b/examples/define-version/action.yml deleted file mode 100644 index 04facff..0000000 --- a/examples/define-version/action.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Terraform Check - With Defined Version - -on: [push, pull_request] - -jobs: - terraform-checks: - runs-on: ubuntu-latest - steps: - - name: Run Terraform Checks Action from oak-terraform-actions - uses: oaknational/oak-terraform-actions/actions/terraform-checks@main - with: - terraform_version: 1.5.7 # or any other version as needed diff --git a/examples/general-use/README.md b/examples/general-use/README.md index b2198fe..4bbc318 100644 --- a/examples/general-use/README.md +++ b/examples/general-use/README.md @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run Terraform Action from oak-terraform-actions uses: oaknational/oak-terraform-actions/actions/terraform@main diff --git a/examples/general-use/action.yml b/examples/general-use/terraform-checks.yml similarity index 56% rename from examples/general-use/action.yml rename to examples/general-use/terraform-checks.yml index 0634c8c..42fa80a 100644 --- a/examples/general-use/action.yml +++ b/examples/general-use/terraform-checks.yml @@ -1,4 +1,5 @@ -name: Terraform Check +# Example Github Workflow file to run Terraform Check action +name: Terraform Checks on: [push, pull_request] @@ -7,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v4 - name: Run Terraform Action from oak-terraform-actions - uses: oaknational/oak-terrform-actions/actions/terraform@main - with: - example_input: "value" + uses: oaknational/oak-terrform-actions/actions/terraform-checks@main