Skip to content

Commit 694cdab

Browse files
authoredJan 18, 2024
Merge pull request #501 from actions/robherley/overwrite-artifact
Ability to overwrite an Artifact
2 parents 1eb3cb2 + 05d4fe6 commit 694cdab

File tree

145 files changed

+597
-9989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+597
-9989
lines changed
 

Diff for: ‎.github/workflows/test.yml

+28
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,31 @@ jobs:
140140
Write-Error "File contents of downloaded artifacts are incorrect"
141141
}
142142
shell: pwsh
143+
144+
# Replace the contents of Artifact #1
145+
- name: 'Overwrite artifact #1 again'
146+
uses: ./
147+
with:
148+
name: 'Artifact-A-${{ matrix.runs-on }}'
149+
path: path/to/dir-2/file2.txt
150+
overwrite: true
151+
152+
# Download replaced Artifact #1 and verify the correctness of the content
153+
- name: 'Download artifact #1 again'
154+
uses: actions/download-artifact@v4
155+
with:
156+
name: 'Artifact-A-${{ matrix.runs-on }}'
157+
path: overwrite/some/new/path
158+
159+
- name: 'Verify Artifact #1 again'
160+
run: |
161+
$file = "overwrite/some/new/path/file2.txt"
162+
if(!(Test-Path -path $file))
163+
{
164+
Write-Error "Expected file does not exist"
165+
}
166+
if(!((Get-Content $file) -ceq "Hello world from file #2"))
167+
{
168+
Write-Error "File contents of downloaded artifacts are incorrect"
169+
}
170+
shell: pwsh

Diff for: ‎.licenses/npm/@actions/artifact.dep.yml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)