Skip to content

Commit

Permalink
Merge pull request #1 from oaknational/ENG-872
Browse files Browse the repository at this point in the history
feat(ENG-872): adding basic folder structure
  • Loading branch information
triwats authored and Tristan Watson committed Aug 12, 2024
2 parents 5870450 + 53266c7 commit c1236ac
Show file tree
Hide file tree
Showing 2,014 changed files with 596,357 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Description

- List of changes related to this PR

## Issue(s)

[ENG-###]()

## How to test

1. ....

## Checklist

- [ ] Something that needs doing
24 changes: 24 additions & 0 deletions .github/workflows/yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: YAML Syntax Check

on: [push, pull_request]

jobs:
lint-yaml:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install yamllint
run: |
python -m pip install --upgrade pip
pip install yamllint
- name: Run yamllint
run: yamllint .
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"yaml.schemas": {
"https://json.schemastore.org/github-action.json": "/actions/terraform/action.yml"
}
}
57 changes: 57 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
### Contributing to Oak Terraform Actions

Thank you for your interest in contributing to the Oak Terrafor Actions repository! We welcome and appreciate your contributions. Here’s how you can get started:

## How to Contribute

1. **Fork the Repository**: Click on the fork button to create your copy of the repository.
2. **Clone Your Fork**: Clone the forked repository to your local machine.
```bash
git clone https://github.com/your-username/oak-terraform-actions.git
```
3. **Create a Branch**: Create a new branch for your feature or bug fix.
```bash
git checkout -b feature/your-feature-name
```
4. **Make Changes**: Implement your changes in the new branch.
5. **Commit Changes**: Commit your changes with a meaningful message.
```bash
git commit -m "Add feature: description of feature"
```
6. **Push Changes**: Push your branch to your fork.
```bash
git push origin feature/your-feature-name
```
7. **Open a Pull Request**: Go to the original repository and open a pull request from your forked repository. Use the [PR template](#pull-request-template) provided below.

## Contribution Guidelines

- **Code Style**: Follow the existing coding style and conventions.
- **Documentation**: Update documentation for any changes or new features.
- **Testing**: Ensure that your code passes all tests and adds new tests if necessary.
- **Review**: Be open to feedback and make changes as requested during the review process.

## Pull Request Template

When submitting a pull request, you will be presented with our Pull Request Template.

### How to Use the Template

1. **Description**: Clearly list and describe the changes made in this PR.
2. **Issue(s)**: Link any related issues using the `[ENG-###]()` format.
3. **How to test**: Provide step-by-step instructions on how to test the changes.
4. **Checklist**: Ensure all tasks and checks are completed before submitting the PR.

## Code of Conduct

Please adhere to the [Code of Conduct](https://github.com/oaknational/oak-terraform-actions/blob/main/CODE_OF_CONDUCT.md) to ensure a welcoming and respectful environment for all contributors.

## Getting Help

If you need help, feel free to open an issue or ask for assistance in your pull request.

> **Tip:** Check out the existing issues for any features or bug fixes you can help with!
We appreciate your contributions and look forward to collaborating with you! 🚀

For more details, visit the [Oak Terraform Actions repository](https://github.com/oaknational/oak-terraform-actions).
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,51 @@
# oak-actions
# oak-terraform-actions

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-checks/
│ ├── action.yml
│ ├── scripts/ (if any)
│ └── README.md
```

### Terraform Actions 🌍

#### Terraform Checks

**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.

### How to Use

```yaml
# Example Github Workflow file to run Terraform Check action
name: Terraform Checks

on: [push, pull_request]

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
```
For more details, visit the [Oak Terraform Actions repository](https://github.com/oaknational/oak-terraform-actions).
# Commits
We're using (husky)[https://github.com/typicode/husky] to create pre-commit hooks with
34 changes: 34 additions & 0 deletions actions/terraform-checks/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: "Terraform Checks"
description: "Perform common Terraform checks"

runs:
using: "composite"
steps:
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ inputs.terraform_version }}

- name: "INFO: Ascertain Terraform Version"
shell: bash
run: terraform --version

- name: "INFO: Linting Terraform Files"
shell: bash
run: |
cd infrastructure
terraform fmt -check $(find . -name '*tf')
- name: "INFO: Validate Terraform Configs"
shell: bash
run: |
cd infrastructure
for d in $(find . -type d -mindepth 1 -maxdepth 1)
do
echo "Validating the $d config"
cd $d
terraform init -backend=false
terraform validate
cd ..
done
1 change: 1 addition & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ["@commitlint/config-conventional"] };
36 changes: 36 additions & 0 deletions examples/general-use/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
### Using the Terraform Action from `oaknational/oak-terraform-actions`

To use the Terraform action from the `oaknational/oak-terraform-actions` repository in your GitHub workflows, follow these steps:

1. **Create a Workflow File**: In your target repository, create a `.github/workflows` directory if it doesn't exist.

2. **Add Workflow Configuration**: Create a workflow file (e.g., `main.yml`) with the following content:

```yaml
name: oak-terraform-action

on:
push:
branches:
- main

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-terraform-actions/actions/terraform@main
with:
example_input: "value"
```
### Explanation
- **uses: oaknational/oak-terraform-actions/actions/terraform@main**: Specifies the action from the `oak-terraform-actions` repository.
- **example_input**: Replace this with the actual input parameters required by the Terraform action 😉.

This setup allows you to incorporate the reusable Terraform action in your CI/CD workflows. For more details, visit the [oaknational/oak-terraform-actions repository](https://github.com/oaknational/oak-terraform-actions).
14 changes: 14 additions & 0 deletions examples/general-use/terraform-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Example Github Workflow file to run Terraform Check action
name: Terraform Checks

on: [push, pull_request]

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
1 change: 1 addition & 0 deletions node_modules/.bin/JSONStream

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/commitlint

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/conventional-commits-parser

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/git-raw-commits

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/husky

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/jiti

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/js-yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/node-which

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tsc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tsserver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c1236ac

Please sign in to comment.