File tree Expand file tree Collapse file tree 13 files changed +218
-70
lines changed Expand file tree Collapse file tree 13 files changed +218
-70
lines changed Original file line number Diff line number Diff line change
1
+ * @ vincenthsh
Original file line number Diff line number Diff line change
1
+ version : 2
2
+ updates :
3
+ - package-ecosystem : gomod
4
+ directory : " /"
5
+ schedule :
6
+ interval : weekly
7
+ open-pull-requests-limit : 10
8
+ labels :
9
+ - bot/merge
10
+ commit-message :
11
+ prefix : " chore: "
12
+ - package-ecosystem : " github-actions"
13
+ directory : " /"
14
+ schedule :
15
+ interval : " weekly"
16
+ labels :
17
+ - bot/merge
18
+ commit-message :
19
+ prefix : " chore: "
20
+ groups :
21
+ github-actions :
22
+ patterns :
23
+ - " *"
Original file line number Diff line number Diff line change
1
+ ### Summary
2
+ A description of changes or issues addressed by this PR. Provide links to relevant PRs if any.
3
+
4
+ ### Test Plan
5
+ Say unittests, or list out steps to verify changes.
6
+
7
+ ### References
8
+ (Optional) Additional links to provide more context.
Original file line number Diff line number Diff line change
1
+ on :
2
+ pull_request :
3
+ branches :
4
+ - master
5
+
6
+ jobs :
7
+ test :
8
+ runs-on : ubuntu-22.04
9
+ steps :
10
+ - uses : actions/checkout@v4
11
+ - uses : actions/setup-go@v5
12
+ with :
13
+ go-version-file : go.mod
14
+ - name : Confirm it builds
15
+ run : make build
Original file line number Diff line number Diff line change
1
+ # Validates PR title follows conventional commits
2
+ on :
3
+ pull_request :
4
+ types :
5
+ - edited
6
+ - opened
7
+ - synchronize
8
+ - reopened
9
+
10
+ jobs :
11
+ conventional_commit_title :
12
+ runs-on : ubuntu-22.04
13
+ steps :
14
+ # source https://github.com/chanzuckerberg/github-actions/blob/cac0ba177b109becac01bc340a3a1547feb40fe5/.github/actions/conventional-commits/action.yml
15
+ - uses : actions/github-script@v7
16
+ with :
17
+ script : |
18
+ const validator = /^(chore|feat|fix|revert|docs|style)(\((((PETI|HSENG|SAENG)-[0-9]+)|([a-z-]+))\))?(!)?: (.)+$/
19
+ const title = context.payload.pull_request.title
20
+ const is_valid = validator.test(title)
21
+
22
+ if (!is_valid) {
23
+ const details = JSON.stringify({
24
+ title: title,
25
+ valid_syntax: validator.toString(),
26
+ })
27
+ core.setFailed(`Your pr title doesn't adhere to conventional commits syntax. See more details: ${details}`)
28
+ }
Original file line number Diff line number Diff line change
1
+ # ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#common-dependabot-automations
2
+ name : Dependabot auto-approve
3
+ on :
4
+ pull_request :
5
+ branches :
6
+ - master
7
+
8
+ permissions :
9
+ # required to set pr to auto merge
10
+ pull-requests : write
11
+ concurrency :
12
+ group : ${{ github.workflow }}-${{ github.ref }}
13
+ cancel-in-progress : true
14
+ jobs :
15
+ dependabot :
16
+ runs-on : ubuntu-22.04
17
+ if : ${{ github.actor == 'dependabot[bot]' }}
18
+ steps :
19
+ - name : Dependabot metadata
20
+ id : metadata
21
+ uses : dependabot/fetch-metadata@v2
22
+ - name : Set to Auto Merge
23
+ run : |
24
+ gh pr merge --auto --squash "$PR_URL"
25
+ env :
26
+ PR_URL : ${{github.event.pull_request.html_url}}
27
+ GITHUB_TOKEN : ${{ secrets.VINCENT_PAT }}
28
+ - name : Approve PR
29
+ run : |
30
+ gh pr review --approve "$PR_URL"
31
+ env :
32
+ PR_URL : ${{github.event.pull_request.html_url}}
33
+ GITHUB_TOKEN : ${{ secrets.VINCENT_PAT }}
Original file line number Diff line number Diff line change
1
+ on :
2
+ push :
3
+ branches :
4
+ - master
5
+
6
+ name : release-please
7
+ jobs :
8
+ release-please :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - name : release please
12
+ uses : google-github-actions/release-please-action@v4.1.0
13
+ id : release
14
+ with :
15
+ # https://github.com/google-github-actions/release-please-action#github-credentials
16
+ token : ${{ secrets.VINCENT_PAT }}
17
+ - uses : actions/checkout@v4
18
+ # we need to fetch all history and tags
19
+ # so we build the proper version
20
+ with :
21
+ fetch-depth : 0
22
+ if : ${{ steps.release.outputs.release_created }}
23
+ - uses : actions/setup-go@v5
24
+ with :
25
+ go-version-file : go.mod
26
+ if : ${{ steps.release.outputs.release_created }}
27
+ - name : Get main.go
28
+ run : make main.go
29
+ if : ${{ steps.release.outputs.release_created }}
30
+ - name : Run GoReleaser
31
+ uses : goreleaser/goreleaser-action@v5
32
+ with :
33
+ version : latest
34
+ args : release --rm-dist
35
+ env :
36
+ GITHUB_TOKEN : ${{ secrets.VINCENT_PAT }}
37
+ if : ${{ steps.release.outputs.release_created }}
Original file line number Diff line number Diff line change 1
- /hclfmt
1
+ /bin
2
2
/dist
3
3
/main.go
4
+ .env
Original file line number Diff line number Diff line change 1
1
builds :
2
- - env :
3
- - CGO_ENABLED=0
2
+ - binary : hclwrite
3
+ env :
4
+ - CGO_ENABLED=0
5
+ goos :
6
+ - darwin
7
+ - linux
8
+ goarch :
9
+ - amd64
10
+ - arm64
11
+ ldflags :
12
+ - " -w -s -X main.versionStr={{.Version}}"
4
13
archives :
5
- - format : gz
6
- files :
7
- - none* # do not include README
8
- replacements :
9
- darwin : Darwin
10
- linux : Linux
11
- windows : Windows
12
- 386 : i386
13
- amd64 : x86_64
14
- checksum :
15
- name_template : ' checksums.txt'
16
- snapshot :
17
- name_template : " {{ .Tag }}-next"
18
- changelog :
19
- sort : asc
20
- filters :
21
- exclude :
22
- - ' ^docs:'
23
- - ' ^test:'
14
+ - format : gz
15
+ files :
16
+ - none* # do not include README
Original file line number Diff line number Diff line change 1
- all : update build
1
+ default : build
2
2
3
- update :
3
+ main.go :
4
4
curl -O https://raw.githubusercontent.com/hashicorp/hcl/hcl2/cmd/hclfmt/main.go
5
+ awk ' {gsub(/^const versionStr/,"var versionStr")}1' main.go > temp && mv temp main.go
5
6
6
- build : # # Build binary
7
- go build
7
+ build : main.go # # Build binary
8
+ go build -o bin/hclfmt
9
+
10
+ # install goreleaser with
11
+ # brew install goreleaser/tap/goreleaser
12
+ snapshot : # # Build snapshot using goreleaser (requires goreleaser to be installed)
13
+ goreleaser build --snapshot --clean
8
14
9
15
help :
10
16
@grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | \
You can’t perform that action at this time.
0 commit comments