@@ -141,12 +141,16 @@ jobs:
141
141
}
142
142
shell : pwsh
143
143
144
+ - name : ' Alter file 1 content'
145
+ run : |
146
+ echo "This file has changed" > path/to/dir-1/file1.txt
147
+
144
148
# Replace the contents of Artifact #1
145
- - name : ' Overwrite artifact #1 again '
149
+ - name : ' Overwrite artifact #1'
146
150
uses : ./
147
151
with :
148
152
name : ' Artifact-A-${{ matrix.runs-on }}'
149
- path : path/to/dir-2/file2 .txt
153
+ path : path/to/dir-1/file1 .txt
150
154
overwrite : true
151
155
152
156
# Download replaced Artifact #1 and verify the correctness of the content
@@ -158,13 +162,55 @@ jobs:
158
162
159
163
- name : ' Verify Artifact #1 again'
160
164
run : |
161
- $file = "overwrite/some/new/path/file2 .txt"
165
+ $file = "overwrite/some/new/path/file1 .txt"
162
166
if(!(Test-Path -path $file))
163
167
{
164
168
Write-Error "Expected file does not exist"
165
169
}
166
- if(!((Get-Content $file) -ceq "Hello world from file #2 "))
170
+ if(!((Get-Content $file) -ceq "This file has changed "))
167
171
{
168
- Write-Error "File contents of downloaded artifacts are incorrect"
172
+ Write-Error "File contents of downloaded artifact are incorrect"
173
+ }
174
+ shell : pwsh
175
+ merge :
176
+ name : Merge
177
+ needs : build
178
+ runs-on : ubuntu-latest
179
+
180
+ steps :
181
+ - name : Checkout
182
+ uses : actions/checkout@v4
183
+
184
+ # Merge Artifact-A-* from previous jobs
185
+ - name : Merge
186
+ uses : ./merge/
187
+ with :
188
+ name : Merged-Artifacts
189
+ pattern : ' Artifact-A-*'
190
+ separate-directories : true
191
+
192
+ # Download merged artifacts and verify the correctness of the content
193
+ - name : ' Download merged artifacts'
194
+ uses : actions/download-artifact@v4
195
+ with :
196
+ name : Merged-Artifacts
197
+ path : merged-artifacts
198
+
199
+ - name : ' Verify merged artifacts'
200
+ run : |
201
+ $files = @(
202
+ "merged-artifacts/Artifact-A-ubuntu-latest/file1.txt",
203
+ "merged-artifacts/Artifact-A-macos-latest/file1.txt",
204
+ "merged-artifacts/Artifact-A-windows-latest/file1.txt"
205
+ )
206
+
207
+ foreach ($file in $files) {
208
+ if (!(Test-Path $file)) {
209
+ Write-Error "$file does not exist."
210
+ }
211
+
212
+ if (!((Get-Content $file) -ceq "This file has changed")) {
213
+ Write-Error "$file has incorrect content."
214
+ }
169
215
}
170
216
shell : pwsh
0 commit comments