Skip to content

Commit 1c9514c

Browse files
update github actions
1 parent 6f1f33c commit 1c9514c

File tree

5 files changed

+74
-18
lines changed

5 files changed

+74
-18
lines changed

.github/workflows/main.yml

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
11
---
22
name: validator
33
# This workflow is triggered on pushes to the repository.
4-
on: [push, pull_request]
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
- master
59

610
jobs:
7-
tflint:
8-
name: TFLint
11+
collectInputs:
12+
name: collect workflow inputs
13+
runs-on: ubuntu-latest
14+
outputs:
15+
directories: ${{ steps.dirs.outputs.directories }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Get root directories
21+
id: dirs
22+
uses: clowdhaus/terraform-composite-actions/[email protected]
23+
24+
tfLint:
25+
name: tflint
926
runs-on: ubuntu-latest
1027
steps:
1128
- uses: actions/checkout@master
@@ -21,7 +38,8 @@ jobs:
2138
- uses: actions/checkout@master
2239
- run: |
2340
terraform fmt --recursive -check=true
24-
docs:
41+
42+
preCommit:
2543
name: pre-commit-hook
2644
runs-on: macOS-latest
2745
steps:

.github/workflows/pr-title.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 'validate-pr-title'
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
name: Validate PR title
13+
runs-on: ubuntu-latest
14+
steps:
15+
# Please look up the latest version from
16+
# https://github.com/amannn/action-semantic-pull-request/releases
17+
- uses: amannn/[email protected]
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
with:
21+
# Configure which types are allowed.
22+
# Default: https://github.com/commitizen/conventional-commit-types
23+
types: |
24+
fix
25+
feat
26+
docs
27+
ci
28+
chore
29+
# Configure that a scope must always be provided.
30+
requireScope: false
31+
# Configure additional validation for the subject based on a regex.
32+
# This example ensures the subject starts with an uppercase character.
33+
subjectPattern: ^[A-Z].+$
34+
# If `subjectPattern` is configured, you can use this property to override
35+
# the default error message that is shown when the pattern doesn't match.
36+
# The variables `subject` and `title` can be used within the message.
37+
subjectPatternError: |
38+
The subject "{subject}" found in the pull request title "{title}"
39+
didn't match the configured pattern. Please ensure that the subject
40+
starts with an uppercase character.
41+
# For work-in-progress PRs you can typically use draft pull requests
42+
# from Github. However, private repositories on the free plan don't have
43+
# this option and therefore this action allows you to opt-in to using the
44+
# special "[WIP]" prefix to indicate this state. This will avoid the
45+
# validation of the PR title and the pull request checks remain pending.
46+
# Note that a second check will be reported if this is enabled.
47+
wip: true
48+
# When using "Squash and merge" on a PR with only one commit, GitHub
49+
# will suggest using that commit message instead of the PR title for the
50+
# merge commit, and it's easy to commit this by mistake. Enable this option
51+
# to also validate the commit message for one commit PRs.
52+
validateSingleCommit: false

.pre-commit-config.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,3 @@ repos:
2222
- id: terraform_fmt
2323
- id: terraform_docs
2424
- id: terraform_tflint
25-
- repo: https://github.com/smian/pre-commit-makefile.git
26-
rev: 261f8fb4b31dfdc05d1a1d7fbde1f1462ecde66d
27-
hooks:
28-
- id: makefile-doc

Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ help: help/local
1616
hooks: ## Commit hooks setup
1717
@pre-commit install
1818
@pre-commit gc
19-
@pre-commit autoupdate
2019

2120
validate: ## Validate with pre-commit hooks
2221
@pre-commit run --all-files

README.md

-9
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,6 @@ module "blueprint" {
4949
Error: no lines in file
5050
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5151

52-
## Commands
53-
54-
<!-- START makefile-doc -->
55-
```
56-
$ make help
57-
hooks Commit hooks setup
58-
validate Validate with pre-commit hooks
59-
```
60-
<!-- END makefile-doc -->
6152

6253
### :memo: Guidelines
6354

0 commit comments

Comments
 (0)