4
4
5
5
name : Helm Chart Building tests
6
6
on :
7
- pull_request_target :
7
+ pull_request :
8
8
push :
9
9
branches :
10
10
- main
@@ -101,7 +101,6 @@ jobs:
101
101
contents : read
102
102
pull-requests : write # required to post a comment to a pull request
103
103
steps :
104
-
105
104
- name : Checkout PR
106
105
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
107
106
with :
@@ -110,13 +109,13 @@ jobs:
110
109
# helm template doesn't reliably order manifests within the same kind, so use yq to do it for us
111
110
- name : Generate manifests for PR
112
111
run : |
113
- mkdir -p /tmp/{old, new}
112
+ mkdir -p "$RUNNER_TEMP/ new"
114
113
for values in charts/matrix-stack/ci/*values.yaml; do
115
114
echo "Generating new templates with $values";
116
115
helm template \
117
116
-a monitoring.coreos.com/v1/ServiceMonitor \
118
117
-f "$values" charts/matrix-stack | \
119
- yq ea '[.] | sort_by(.kind, .metadata.name) | .[] | splitDoc' > "/tmp /new/$(basename "$values")"
118
+ yq ea '[.] | sort_by(.kind, .metadata.name) | .[] | splitDoc' > "$RUNNER_TEMP /new/$(basename "$values")"
120
119
done
121
120
122
121
- name : Checkout target
@@ -126,12 +125,13 @@ jobs:
126
125
127
126
- name : Generate manifests for base
128
127
run : |
128
+ mkdir -p "$RUNNER_TEMP/old"
129
129
for values in charts/matrix-stack/ci/*values.yaml; do
130
130
echo "Generating old templates with $values";
131
131
helm template \
132
132
-a monitoring.coreos.com/v1/ServiceMonitor \
133
133
-f "$values" charts/matrix-stack | \
134
- yq ea '[.] | sort_by(.kind, .metadata.name) | .[] | splitDoc' > "/tmp /old/$(basename "$values")"
134
+ yq ea '[.] | sort_by(.kind, .metadata.name) | .[] | splitDoc' > "$RUNNER_TEMP /old/$(basename "$values")"
135
135
done
136
136
137
137
- name : Install dyff with asdf
@@ -145,24 +145,25 @@ jobs:
145
145
146
146
- name : dyff old and new manifests
147
147
id : dyff
148
+ shell : bash
148
149
run : |
149
- templates_files=$(find /tmp/ old /tmp/ new -maxdepth 1 -name '*values.yaml' | sed -E 's|/tmp /(old\|new)/||' | sort | uniq)
150
+ templates_files=$(find "$RUNNER_TEMP/ old" "$RUNNER_TEMP/ new" -maxdepth 1 -name '*values.yaml' | sed -E 's|'"$RUNNER_TEMP"' /(old\|new)/||' | sort | uniq)
150
151
151
152
header="# dyff of changes in rendered templates of CI manifests\n\n"
152
153
comment_body=""
153
154
while read -r templates_file; do
154
- if [ ! -f "/tmp /old/$templates_file" ]; then
155
+ if [ ! -f "$RUNNER_TEMP /old/$templates_file" ]; then
155
156
comment_body+="**$templates_file** (added)\n\n"
156
157
continue
157
158
fi
158
159
159
- if [ ! -f "/tmp /new/$templates_file" ]; then
160
+ if [ ! -f "$RUNNER_TEMP /new/$templates_file" ]; then
160
161
comment_body+="**$templates_file** (removed)\n\n"
161
162
continue
162
163
fi
163
164
164
165
exit_code=0
165
- dyff_detail=$(dyff between --set-exit-code --omit-header --output=github "/tmp/ old/$templates_file" "/tmp /new/$templates_file") || exit_code=$?
166
+ dyff_detail=$(dyff between --set-exit-code --omit-header --output=github "$RUNNER_TEMP/ old/$templates_file" "$RUNNER_TEMP /new/$templates_file") || exit_code=$?
166
167
if [ $exit_code -ne 0 ]; then
167
168
comment_body+="<details><summary><b>$templates_file</b> (changed)</summary>\n"
168
169
comment_body+='\n```diff\n'
@@ -175,7 +176,7 @@ jobs:
175
176
comment_body="No changes in rendered templates"
176
177
fi
177
178
178
- echo -e "$header$comment_body" | tee "/tmp /dyff-output"
179
+ echo -e "$header$comment_body" | tee "$RUNNER_TEMP /dyff-output"
179
180
180
181
- name : Find dyff comment
181
182
if : github.event.pull_request.number != ''
@@ -192,5 +193,5 @@ jobs:
192
193
with :
193
194
comment-id : ${{ steps.find-dyff-comment.outputs.comment-id }}
194
195
issue-number : ${{ github.event.pull_request.number }}
195
- body-path : /tmp /dyff-output
196
+ body-path : ${{ runner.temp }} /dyff-output
196
197
edit-mode : replace
0 commit comments