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

feat(ENG-872): adding basic folder structure #1

Merged
merged 9 commits into from
Aug 8, 2024
Merged
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
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

Check warning on line 1 in .github/workflows/yaml-lint.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

1:1 [document-start] missing document start "---"

Check warning on line 1 in .github/workflows/yaml-lint.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

1:1 [document-start] missing document start "---"

on: [push, pull_request]

Check warning on line 3 in .github/workflows/yaml-lint.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

3:1 [truthy] truthy value should be one of [false, true]

Check warning on line 3 in .github/workflows/yaml-lint.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

3:1 [truthy] truthy value should be one of [false, true]

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 .
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).
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
# 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).
33 changes: 33 additions & 0 deletions actions/terraform-checks/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Terraform Checks"

Check warning on line 1 in actions/terraform-checks/action.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

1:1 [document-start] missing document start "---"

Check warning on line 1 in actions/terraform-checks/action.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

1:1 [document-start] missing document start "---"
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
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

Check warning on line 2 in examples/general-use/terraform-checks.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

2:1 [document-start] missing document start "---"

Check warning on line 2 in examples/general-use/terraform-checks.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

2:1 [document-start] missing document start "---"

on: [push, pull_request]

Check warning on line 4 in examples/general-use/terraform-checks.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

4:1 [truthy] truthy value should be one of [false, true]

Check warning on line 4 in examples/general-use/terraform-checks.yml

View workflow job for this annotation

GitHub Actions / lint-yaml

4:1 [truthy] truthy value should be one of [false, true]

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
Loading