2
2
name : build
3
3
4
4
on :
5
- push :
5
+ merge_group :
6
+ types :
7
+ - checks_requested
6
8
pull_request :
9
+ push :
7
10
repository_dispatch :
8
- types : [apb]
11
+ types :
12
+ - apb
13
+
14
+ # Set a default shell for any run steps. The `-Eueo pipefail` sets errtrace,
15
+ # nounset, errexit, and pipefail. The `-x` will print all commands as they are
16
+ # run. Please see the GitHub Actions documentation for more information:
17
+ # https://docs.github.com/en/actions/using-jobs/setting-default-values-for-jobs
18
+ defaults :
19
+ run :
20
+ shell : bash -Eueo pipefail -x {0}
9
21
10
22
env :
11
23
CURL_CACHE_DIR : ~/.cache/curl
12
24
PIP_CACHE_DIR : ~/.cache/pip
13
25
PRE_COMMIT_CACHE_DIR : ~/.cache/pre-commit
14
26
RUN_TMATE : ${{ secrets.RUN_TMATE }}
27
+ TERRAFORM_DOCS_REPO_BRANCH_NAME : improvement/support_atx_closed_markdown_headers
28
+ TERRAFORM_DOCS_REPO_DEPTH : 1
29
+ TERRAFORM_DOCS_REPO_URL : https://github.com/mcdonnnj/terraform-docs.git
15
30
16
31
jobs :
17
32
diagnostics :
27
42
egress-policy : audit
28
43
- id : github-status
29
44
name : Check GitHub status
30
- uses : crazy-max/ghaction-github-status@v3
45
+ uses : crazy-max/ghaction-github-status@v4
31
46
- id : dump-context
32
47
name : Dump context
33
48
uses : crazy-max/ghaction-dump-context@v2
@@ -45,20 +60,20 @@ jobs:
45
60
uses : cisagov/setup-env-github-action@develop
46
61
- uses : actions/checkout@v4
47
62
- id : setup-python
48
- uses : actions/setup-python@v4
63
+ uses : actions/setup-python@v5
49
64
with :
50
- python-version : " 3.11 "
65
+ python-version : ${{ steps.setup-env.outputs.python-version }}
51
66
# We need the Go version and Go cache location for the actions/cache step,
52
67
# so the Go installation must happen before that.
53
68
- id : setup-go
54
- uses : actions/setup-go@v4
69
+ uses : actions/setup-go@v5
55
70
with :
56
71
# There is no expectation for actual Go code so we disable caching as
57
72
# it relies on the existence of a go.sum file.
58
73
cache : false
59
- go-version : " 1.20 "
60
- - name : Lookup Go cache directory
61
- id : go- cache
74
+ go-version : ${{ steps.setup-env.outputs.go-version }}
75
+ - id : go- cache
76
+ name : Lookup Go cache directory
62
77
run : |
63
78
echo "dir=$(go env GOCACHE)" >> $GITHUB_OUTPUT
64
79
- uses : actions/cache@v3
69
84
packer${{ steps.setup-env.outputs.packer-version }}-\
70
85
tf${{ steps.setup-env.outputs.terraform-version }}-"
71
86
with :
87
+ key : " ${{ env.BASE_CACHE_KEY }}\
88
+ ${{ hashFiles('**/requirements-test.txt') }}-\
89
+ ${{ hashFiles('**/requirements.txt') }}-\
90
+ ${{ hashFiles('**/.pre-commit-config.yaml') }}"
72
91
# Note that the .terraform directory IS NOT included in the
73
92
# cache because if we were caching, then we would need to use
74
93
# the `-upgrade=true` option. This option blindly pulls down the
80
99
${{ env.PRE_COMMIT_CACHE_DIR }}
81
100
${{ env.CURL_CACHE_DIR }}
82
101
${{ steps.go-cache.outputs.dir }}
83
- key : " ${{ env.BASE_CACHE_KEY }}\
84
- ${{ hashFiles('**/requirements-test.txt') }}-\
85
- ${{ hashFiles('**/requirements.txt') }}-\
86
- ${{ hashFiles('**/.pre-commit-config.yaml') }}"
87
102
restore-keys : |
88
103
${{ env.BASE_CACHE_KEY }}
89
104
- name : Setup curl cache
@@ -101,34 +116,46 @@ jobs:
101
116
${{ env.CURL_CACHE_DIR }}/"${PACKER_ZIP}"
102
117
sudo mv /usr/local/bin/packer /usr/local/bin/packer-default
103
118
sudo ln -s /opt/packer/packer /usr/local/bin/packer
104
- - uses : hashicorp/setup-terraform@v2
119
+ - uses : hashicorp/setup-terraform@v3
105
120
with :
106
121
terraform_version : ${{ steps.setup-env.outputs.terraform-version }}
107
122
- name : Install go-critic
108
123
env :
109
124
PACKAGE_URL : github.com/go-critic/go-critic/cmd/gocritic
110
125
PACKAGE_VERSION : ${{ steps.setup-env.outputs.go-critic-version }}
111
126
run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
127
+ - name : Install goimports
128
+ env :
129
+ PACKAGE_URL : golang.org/x/tools/cmd/goimports
130
+ PACKAGE_VERSION : ${{ steps.setup-env.outputs.goimports-version }}
131
+ run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
112
132
- name : Install gosec
113
133
env :
114
134
PACKAGE_URL : github.com/securego/gosec/v2/cmd/gosec
115
135
PACKAGE_VERSION : ${{ steps.setup-env.outputs.gosec-version }}
116
136
run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
117
- - name : Install shfmt
118
- env :
119
- PACKAGE_URL : mvdan.cc/sh/v3/cmd/shfmt
120
- PACKAGE_VERSION : ${{ steps.setup-env.outputs.shfmt-version }}
121
- run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
122
137
- name : Install staticcheck
123
138
env :
124
139
PACKAGE_URL : honnef.co/go/tools/cmd/staticcheck
125
140
PACKAGE_VERSION : ${{ steps.setup-env.outputs.staticcheck-version }}
126
141
run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
127
- - name : Install Terraform-docs
128
- env :
129
- PACKAGE_URL : github.com/terraform-docs/terraform-docs
130
- PACKAGE_VERSION : ${{ steps.setup-env.outputs.terraform-docs-version }}
131
- run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
142
+ # TODO: https://github.com/cisagov/skeleton-generic/issues/165
143
+ # We are temporarily using @mcdonnnj's forked branch of terraform-docs
144
+ # until his PR: https://github.com/terraform-docs/terraform-docs/pull/745
145
+ # is approved. This temporary fix will allow for ATX header support when
146
+ # terraform-docs is run during linting.
147
+ - name : Clone ATX headers branch from terraform-docs fork
148
+ run : |
149
+ git clone \
150
+ --branch $TERRAFORM_DOCS_REPO_BRANCH_NAME \
151
+ --depth $TERRAFORM_DOCS_REPO_DEPTH \
152
+ --single-branch \
153
+ $TERRAFORM_DOCS_REPO_URL /tmp/terraform-docs
154
+ - name : Build and install terraform-docs binary
155
+ run : |
156
+ go build \
157
+ -C /tmp/terraform-docs \
158
+ -o $(go env GOPATH)/bin/terraform-docs
132
159
- name : Install dependencies
133
160
run : |
134
161
python -m pip install --upgrade pip setuptools wheel
0 commit comments