Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ENG-867): add default version of the action, add new example #6

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,23 @@ actions/
# Example Github Workflow file to run Terraform Check action
name: Terraform Checks

on: [push, pull_request]
on: [push] # yamllint disable-line rule:truthy

jobs:
example-job:
terraform-lint-format:
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-checks/action.yml@main
uses: oaknational/oak-terraform-actions/actions/terraform-checks@main
```

For more details, visit the [Oak Terraform Actions repository](https://github.com/oaknational/oak-terraform-actions).

You can also define the version required if necessary. See the examples folder.

# Commitlint

We're using [husky](https://github.com/typicode/husky) to create pre-commit hooks with commitlint and the [conventional commit plugin](https://github.com/conventional-changelog/commitlint).
Expand Down
7 changes: 7 additions & 0 deletions actions/terraform-checks/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
---
name: "Terraform Checks"
description: "Perform common Terraform checks"

# Can be overriden by the developer when using this action
inputs:
terraform_version:
description: "The version of Terraform to use"
default: "1.94"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set this to the newest version as default - but pinned. This prevents version from changing around ONA.


runs:
using: "composite"
steps:
Expand Down
17 changes: 17 additions & 0 deletions examples/pinned-version/terraform-checks-pinned.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# Example Github Workflow file to run Terraform Check action
name: Terraform Checks

on: [push, pull_request] # yamllint disable-line rule:truthy

jobs:
example-job:
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-checks@main
with:
terraform_version: "1.5.7" # Override the default version here