Skip to content

Commit

Permalink
ci: add GH actions (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetOps authored Apr 19, 2021
1 parent 44791a1 commit 0f5f20c
Show file tree
Hide file tree
Showing 13 changed files with 360 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @SweetOps
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: SweetOps

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Terraform version**
Output of command:
```sh
terraform version
```
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'feature'
assignees: 'SweetOps'

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
59 changes: 59 additions & 0 deletions .github/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
version-template: '$MAJOR.$MINOR.$PATCH'
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
- 'enhancement'
- 'feat'
patch:
labels:
- 'auto-update'
- 'patch'
- 'fix'
- 'bugfix'
- 'bug'
- 'hotfix'
- 'refactor'
- 'ci'
- 'build'
- 'docs'
- 'test'
- 'chore'
default: 'minor'

categories:
- title: '🚀 Enhancements'
labels:
- 'minor'
- 'enhancement'
- 'feat'
- title: '🐛 Bug Fixes'
labels:
- 'auto-update'
- 'patch'
- 'fix'
- 'bugfix'
- 'bug'
- 'hotfix'
- 'refactor'
- 'ci'
- 'build'
- 'docs'
- 'test'
- 'chore'
- title: '🤖 Automatic Updates'
labels:
- 'auto-update'

change-template: |
<details>
<summary>$TITLE @$AUTHOR (#$NUMBER)</summary>
$BODY
</details>
template: |
$CHANGES
27 changes: 27 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: v1

labels:
- label: "feat"
matcher:
title: "^feat:.*"
- label: "fix"
matcher:
title: "^fix:.*"
- label: "ci"
matcher:
title: "^ci:.*"
- label: "chore"
matcher:
title: "^chore:.*"
- label: "build"
matcher:
title: "^build:.*"
- label: "docs"
matcher:
title: "^docs:.*"
- label: "refactor"
matcher:
title: "^refactor:.*"
- label: "test"
matcher:
title: "^test:.*"
57 changes: 57 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
# Default GitHub labels
- color: d73a4a
name: bug
description: Something isn't working
- color: cfd3d7
name: duplicate
description: This issue or pull request already exists
- color: a2eeef
name: enhancement
description: New feature or request
- color: 7057ff
name: good first issue
description: Good for newcomers
- color: 008672
name: help wanted
description: Extra attention is needed
- color: e4e669
name: invalid
description: This doesn't seem right
- color: d876e3
name: question
description: Further information is requested
- color: ffffff
name: wontfix
description: This will not be worked on

- color: a0040c
name: no-pr-activity
description: stalled PR
- color: d93f0b
name: no-issue-activity
description: stalled issue
- color: f9dcbd
name: build
description: Changes that affect the build system or external dependencies
- color: 63dae2
name: ci
description: Changes to our CI configuration files and scripts
- color: 6e93e5
name: docs
description: Documentation only changes
- color: 5edb3f
name: feat
description: A new feature
- color: 58e8c8
name: fix
description: A bug fix
- color: efada0
name: refactor
description: A code change that neither fixes a bug nor adds a feature
- color: 1d76db
name: test
description: Adding missing tests or correcting existing tests
- color: dfb443
name: chore
description: Adding missing tests or correcting existing tests
29 changes: 29 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Generate terraform docs
on:
pull_request_target:

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: main docs
uses: Dirrk/[email protected]
with:
tf_docs_working_dir: .
tf_docs_output_file: README.md
tf_docs_output_method: inject
tf_docs_git_push: 'true'
tf_docs_args: '--sort-inputs-by-required'

- name: basic example docs
uses: Dirrk/[email protected]
with:
tf_docs_working_dir: ./examples/basic/
tf_docs_output_file: README.md
tf_docs_output_method: inject
tf_docs_git_push: 'true'
tf_docs_args: '--sort-inputs-by-required'
13 changes: 13 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Auto Label
on:
pull_request_target:

jobs:
labeler:
name: Labeler
runs-on: ubuntu-latest
steps:
- uses: fuxingloh/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
config-path: .github/labeler.yml
17 changes: 17 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Sync labels in the declarative way
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: micnncim/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
with:
manifest: .github/labels.yml
36 changes: 36 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint PR
on:
pull_request_target:

jobs:
main:
runs-on: ubuntu-latest

steps:
- name: Lint PR
uses: aslafy-z/conventional-pr-title-action@master
with:
preset: conventional-changelog-angular@^5.0.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Comment for PR title conformance
if: failure()
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{tojson(github.event.number)}}
body: |
Please ensure your PR conforms to conventional commits (see https://www.conventionalcommits.org).
Commits MUST be prefixed with a type, which consists of one of the following:
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
* **docs**: Documentation only changes
* **feat**: A new feature
* **fix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* **test**: Adding missing tests or correcting existing tests
* **chore**: No production code change
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

name: Release Drafter

on:
push:
branches:
- master

jobs:
publish:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
with:
publish: true
prerelease: false
config-name: auto-release.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Mark stale issues and pull requests

on:
schedule:
- cron: "0 12 * * *"

jobs:
stale:

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
stale-pr-message: 'This pull-request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
days-before-stale: 30
days-before-close: 5
34 changes: 34 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Validate TF manifests'
on:
pull_request_target:

jobs:
terraform:
name: Terraform
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.14.7

- name: Terraform Format
run: terraform fmt

- name: Terraform Init
run: terraform init

- name: Terraform Validate
run: terraform validate -no-color

- name: tflint
uses: reviewdog/action-tflint@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
fail_on_error: "true"
filter_mode: "nofilter"
flags: "--module"

0 comments on commit 0f5f20c

Please sign in to comment.