Skip to content

Commit 712ac89

Browse files
committed
Initial GitHub Workflows
1 parent 0fd72e2 commit 712ac89

File tree

4 files changed

+194
-0
lines changed

4 files changed

+194
-0
lines changed

.github/workflows/lock_threads.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: 'Lock Threads'
3+
4+
on:
5+
schedule:
6+
- cron: '15 1 * * *'
7+
8+
jobs:
9+
lock:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: dessant/lock-threads@v4
13+
with:
14+
github-token: ${{ secrets.GITHUB_TOKEN }}
15+
issue-comment: >
16+
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
17+
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
18+
issue-inactive-days: '30'
19+
pr-comment: >
20+
I'm going to lock this pull request because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
21+
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
22+
pr-inactive-days: '30'

.github/workflows/pre-commit.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
name: Pre-Commit
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
- master
9+
10+
env:
11+
TERRAFORM_DOCS_VERSION: v0.16.0
12+
TFLINT_VERSION: v0.44.1
13+
14+
jobs:
15+
collectInputs:
16+
name: Collect workflow inputs
17+
runs-on: ubuntu-latest
18+
outputs:
19+
directories: ${{ steps.dirs.outputs.directories }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
24+
- name: Get root directories
25+
id: dirs
26+
uses: clowdhaus/terraform-composite-actions/directories@v1.8.3
27+
28+
preCommitMinVersions:
29+
name: Min TF pre-commit
30+
needs: collectInputs
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
39+
- name: Terraform min/max versions
40+
id: minMax
41+
uses: clowdhaus/terraform-min-max@v1.2.4
42+
with:
43+
directory: ${{ matrix.directory }}
44+
45+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
46+
# Run only validate pre-commit check on min version supported
47+
if: ${{ matrix.directory != '.' }}
48+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3
49+
with:
50+
terraform-version: ${{ steps.minMax.outputs.minVersion }}
51+
tflint-version: ${{ env.TFLINT_VERSION }}
52+
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'
53+
54+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
55+
# Run only validate pre-commit check on min version supported
56+
if: ${{ matrix.directory == '.' }}
57+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3
58+
with:
59+
terraform-version: ${{ steps.minMax.outputs.minVersion }}
60+
tflint-version: ${{ env.TFLINT_VERSION }}
61+
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'
62+
63+
preCommitMaxVersion:
64+
name: Max TF pre-commit
65+
runs-on: ubuntu-latest
66+
needs: collectInputs
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v3
70+
with:
71+
ref: ${{ github.event.pull_request.head.ref }}
72+
repository: ${{github.event.pull_request.head.repo.full_name}}
73+
74+
- name: Terraform min/max versions
75+
id: minMax
76+
uses: clowdhaus/terraform-min-max@v1.2.6
77+
78+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
79+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3
80+
with:
81+
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
82+
tflint-version: ${{ env.TFLINT_VERSION }}
83+
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}
84+
install-hcledit: true
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: 'Validate PR titles'
3+
4+
on:
5+
pull_request_target:
6+
types:
7+
- opened
8+
- edited
9+
- synchronize
10+
11+
jobs:
12+
main:
13+
name: Validate PR titles
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Please look up the latest version from
17+
# https://github.com/amannn/action-semantic-pull-request/releases
18+
- uses: amannn/action-semantic-pull-request@v5.2.0
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
# Configure which types are allowed.
23+
# Default: https://github.com/commitizen/conventional-commit-types
24+
types: |
25+
ci
26+
chore
27+
docs
28+
feat
29+
fix
30+
perf
31+
refactor
32+
# Configure that a scope must always be provided.
33+
requireScope: false
34+
# Configure additional validation for the subject based on a regex.
35+
# This example ensures the subject starts with an uppercase character.
36+
subjectPattern: ^[A-Z].+$
37+
# If `subjectPattern` is configured, you can use this property to override
38+
# the default error message that is shown when the pattern doesn't match.
39+
# The variables `subject` and `title` can be used within the message.
40+
subjectPatternError: |
41+
The subject "{subject}" found in the pull request title "{title}"
42+
didn't match the configured pattern. Please ensure that the subject
43+
starts with an uppercase character.
44+
# For work-in-progress PRs you can typically use draft pull requests
45+
# from Github. However, private repositories on the free plan don't have
46+
# this option and therefore this action allows you to opt-in to using the
47+
# special "[WIP]" prefix to indicate this state. This will avoid the
48+
# validation of the PR title and the pull request checks remain pending.
49+
# Note that a second check will be reported if this is enabled.
50+
wip: true
51+
# When using "Squash and merge" on a PR with only one commit, GitHub
52+
# will suggest using that commit message instead of the PR title for the
53+
# merge commit, and it's easy to commit this by mistake. Enable this option
54+
# to also validate the commit message for one commit PRs.
55+
validateSingleCommit: false
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: 'Mark or close stale issues and PRs'
3+
on:
4+
schedule:
5+
- cron: '0 1 * * *'
6+
7+
jobs:
8+
stale:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/stale@v6
12+
with:
13+
repo-token: ${{ secrets.GITHUB_TOKEN }}
14+
# Staling issues and PR's
15+
days-before-stale: 30
16+
stale-issue-label: stale
17+
stale-pr-label: stale
18+
stale-issue-message: |
19+
This issue has been automatically marked as stale because it has been open 30 days
20+
with no activity. Remove stale label or comment or this issue will be closed in 10 days
21+
stale-pr-message: |
22+
This PR has been automatically marked as stale because it has been open 30 days
23+
with no activity. Remove stale label or comment or this PR will be closed in 10 days
24+
# Not stale if have this labels or part of milestone
25+
exempt-issue-labels: bug,wip,on-hold
26+
exempt-pr-labels: bug,wip,on-hold
27+
exempt-all-milestones: true
28+
# Close issue operations
29+
# Label will be automatically removed if the issues are no longer closed nor locked.
30+
days-before-close: 10
31+
delete-branch: true
32+
close-issue-message: This issue was automatically closed because of stale in 10 days
33+
close-pr-message: This PR was automatically closed because of stale in 10 days

0 commit comments

Comments
 (0)