-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat req] add option to overwrite existing artifacts #471
Comments
👋 If you need to delete an artifact, you can do it with Here's a full example: name: Delete Artifact Example
on:
workflow_dispatch:
permissions:
actions: write # required permission to delete artifact
jobs:
upload-and-delete:
runs-on: ubuntu-latest
steps:
- name: Create a File
run: echo "hello world" > hello.txt
- name: Upload Artifact
id: artifact-upload
uses: actions/upload-artifact@v4
with:
name: my-artifact
path: hello.txt
- name: Delete Artifact
uses: actions/github-script@v7
with:
script: |
github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: ${{ steps.artifact-upload.outputs.artifact-id }}
});
- name: Upload Artifact (again)
uses: actions/upload-artifact@v4
with:
name: my-artifact
path: hello.txt Make sure you have the correct permissions set for the permissions:
actions: write I'm not sure if we're going to have an official "overwrite" at this time, since artifacts become immediately available in the public API in v4, unlike in v3 where you had to wait until the end of the run. But thanks for the feedback and I'll bring it up with the team! |
thanks for the workaround. For now, i just keep using v3 while hoping there will be a option to overwrite again in the future. If there are any implications, you could mention this in the docs and leave the decision to the user? |
I would like to see this feature added too, I saw the workaround but I will keep using v3 until this is addressed as well. |
@robherley I guess that will not work in matrix |
@zdgeorgiev It still works fine in a matrix: name: Delete Artifact Matrix Example
on:
workflow_dispatch:
permissions:
actions: write # required permission to delete artifact
jobs:
upload-and-delete:
strategy:
matrix:
example: ['foo', 'bar']
runs-on: ubuntu-latest
steps:
- name: Create a File
run: echo "hello world" > hello.txt
- name: Upload Artifact
id: artifact-upload
uses: actions/upload-artifact@v4
with:
name: my-artifact-${{ matrix.example }}
path: hello.txt
- name: Delete Artifact
uses: actions/github-script@v7
with:
script: |
github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: ${{ steps.artifact-upload.outputs.artifact-id }}
});
- name: Upload Artifact (again)
uses: actions/upload-artifact@v4
with:
name: my-artifact-${{ matrix.example }}
path: hello.txt You can even use the list artifacts API in octokit to list/filter/reduce on the artifact names and pass them to delete artifact. |
TBH, that would be great as you would have easier interaction among jobs, not when a simple way to pass |
**Description:** I think v4 is broken (or the way we are using the action is no longer supported in v4). Switching back to v3 for now to fix our CI. **Link to tracking Issue:** <Issue number if applicable> I think actions/upload-artifact#471 **Testing:** <Describe what testing was performed and which tests were added.> **Documentation:** <Describe the documentation added.>
We saw similar failures in the collector repositories. See an example of a failure: https://github.com/open-telemetry/opentelemetry-go-contrib/actions/runs/7292851552/job/19874703538?pr=4741 There's an open issue around this: actions/upload-artifact#471 Signed-off-by: Alex Boten <aboten@lightstep.com>
We saw similar failures in the collector repositories. See an example of a failure: https://github.com/open-telemetry/opentelemetry-go-contrib/actions/runs/7292851552/job/19874703538?pr=4741 There's an open issue around this: actions/upload-artifact#471 Signed-off-by: Alex Boten <aboten@lightstep.com>
@robherley that's unfortunate, I hope by looking at the number of issues/pr linked that will change. It seems like most are downgrading due to this not being a feature in v4. |
@onedr0p 👋 I agree. Going to bring this back to the team considering how likely it'll be required. Thanks for the feedback! |
**Description:** I think v4 is broken (or the way we are using the action is no longer supported in v4). Switching back to v3 for now to fix our CI. **Link to tracking Issue:** <Issue number if applicable> I think actions/upload-artifact#471 **Testing:** <Describe what testing was performed and which tests were added.> **Documentation:** <Describe the documentation added.>
**Description:** I think v4 is broken (or the way we are using the action is no longer supported in v4). Switching back to v3 for now to fix our CI. **Link to tracking Issue:** <Issue number if applicable> I think actions/upload-artifact#471 **Testing:** <Describe what testing was performed and which tests were added.> **Documentation:** <Describe the documentation added.>
@robherley: were you able to address the issue with the team? |
**Description:** I think v4 is broken (or the way we are using the action is no longer supported in v4). Switching back to v3 for now to fix our CI. **Link to tracking Issue:** <Issue number if applicable> I think actions/upload-artifact#471 **Testing:** <Describe what testing was performed and which tests were added.> **Documentation:** <Describe the documentation added.>
👋 @sni If all goes well, we should have this ready by tomorrow! I have a toolkit PR open to delete artifacts, once that is merged and published I'll add an input to |
👋 This is now possible! Check out the example in the readme: https://github.com/actions/upload-artifact#overwriting-an-artifact |
Is this rolled out yet? we are seeing the following error on this workflow:
|
Me too seeing this issue in v4. Downgrading to v3 fixes it for me. |
This worked for me! Thanks for adding this |
I'm having the same issue. Even with |
What would you like to be added?
It would be nice to have a option to allow overwrite existing artifacts like it was possible in v3.
Why is this needed?
I have an optional workflow step to sign artifacts, it downloads an artifact, signs it and uploads it with the same name again. Worked perfectly fine with
actions/upload-artifact@v3
.I tried to use
geekyeggo/delete-artifact@v2
but even that doesn't work.Since this step is not applicable for pull requests, it would make things quite complicated to continue with separate artifact names.
The text was updated successfully, but these errors were encountered: