Skip to content

Commit

Permalink
chore: bump ci templates (#181)
Browse files Browse the repository at this point in the history
* fix: go mod changed format

Ref:
- golang/go#62278 (comment)

may require re-installing go language server after upgrading to 1.21

```sh
go install golang.org/x/tools/gopls@latest
```

or:

1. Press Ctrl Shift P
1. Select Go: Install/Update tools

* chore: bump gh action versions

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `2.4.0` | `4.0.0` |
| [actions/cache](https://github.com/actions/cache) | `2` | `3` |
| [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) | `1.6.1` | `4.0.0` |
| [actions/setup-python](https://github.com/actions/setup-python) | `3` | `4` |
| [mfinelli/setup-shfmt](https://github.com/mfinelli/setup-shfmt) | `1` | `2` |
| [dorny/paths-filter](https://github.com/dorny/paths-filter) | `2.10.2` | `2.11.1` |
| [terraform-linters/setup-tflint](https://github.com/terraform-linters/setup-tflint) | `2` | `3` |

* chore: run make update-golden-files

* chore: Add PR conventional commit title check
  • Loading branch information
vincenthsh authored Sep 13, 2023
1 parent aef3cab commit 466bdda
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 36 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/conventional_commits_title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Validates PR title follows conventional commits
on:
pull_request:
types:
- edited
- opened
- synchronize
- reopened

jobs:
conventional_commit_title:
runs-on: ubuntu-22.04
steps:
# source https://github.com/chanzuckerberg/github-actions/blob/cac0ba177b109becac01bc340a3a1547feb40fe5/.github/actions/conventional-commits/action.yml
- uses: actions/github-script@v6
with:
script: |
const validator = /^(chore|feat|fix|revert|docs|style)(\((((CCIE|CDI|PRODSEC|SECENG|ONCALL)-[0-9]+)|([a-z]+))\))?(!)?: (.)+$/
const title = context.payload.pull_request.title
const is_valid = validator.test(title)
if (!is_valid) {
const details = JSON.stringify({
title: title,
valid_syntax: validator.toString(),
})
core.setFailed(`Your pr title doesn't adhere to conventional commits syntax. See more details: ${details}`)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/chanzuckerberg/fogg

go 1.21
go 1.21.1

replace github.com/spf13/afero => github.com/chanzuckerberg/afero v0.0.0-20190514223411-36a9495a9b51

Expand Down
18 changes: 9 additions & 9 deletions templates/templates/.github/workflows/fogg_ci.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
# required to push fixes back to repo
contents: write{{ end }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.0.0
with:
repository: {{`${{ github.event.pull_request.head.repo.full_name }}`}}
ref: {{`${{ github.event.pull_request.head.ref }}`}}
Expand All @@ -30,15 +30,15 @@ jobs:
- run: make setup
{{- if not (eq (len $githubActionsCI.DefaultAWSIAMRoleName) 0) }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4.0.0
with:
role-to-assume: {{ $githubActionsCI.DefaultAWSIAMRoleName }}
aws-region: {{ $githubActionsCI.DefaultAWSRegion }}{{ end }}
- run: .fogg/bin/fogg apply
env:
FOGG_GITHUBTOKEN: {{`${{ secrets.GITHUB_TOKEN }}`}}
- uses: actions/setup-python@v3
- uses: mfinelli/setup-shfmt@v1
- uses: actions/setup-python@v4
- uses: mfinelli/setup-shfmt@v2
with:
shfmt-version: 3.5.1
- uses: rhythmictech/[email protected]
Expand All @@ -56,11 +56,11 @@ jobs:
outputs:
allChanges: {{`${{ steps.changedDirs.outputs.allChanges }}`}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.0.0
with:
repository: {{`${{ github.event.pull_request.head.repo.full_name }}`}}
ref: {{`${{ github.event.pull_request.head.ref }}`}}
- uses: dorny/paths-filter@v2.10.2
- uses: dorny/paths-filter@v2.11.1
id: filter
with:
initial-fetch-depth: '1'
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
tfmodule: {{`${{ fromJson(needs.find-changed-dirs.outputs.allChanges) }}`}}
if: {{`${{ needs.find-changed-dirs.outputs.allChanges != '[]' }}`}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.0.0
with:
token: {{`${{ secrets.GITHUB_TOKEN }}`}}
repository: {{`${{ github.event.pull_request.head.repo.full_name }}`}}
Expand All @@ -118,12 +118,12 @@ jobs:
add: -A
message: |
commit from fogg_ci -- ran terraform fmt and pushed
- uses: actions/cache@v2
- uses: actions/cache@v3
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: tflint-{{`${{ hashFiles('.tflint.hcl') }}`}}
- uses: terraform-linters/setup-tflint@v2
- uses: terraform-linters/setup-tflint@v3
name: Setup TFLint
with:
tflint_version: v0.47.0
Expand Down
16 changes: 8 additions & 8 deletions testdata/github_actions/.github/workflows/fogg_ci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions testdata/v2_full_yaml/.github/workflows/fogg_ci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 466bdda

Please sign in to comment.