Skip to content
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

Unable to delete artifacts uploaded by actions/upload-artifact@v4 #14

Closed
muzimuzhi opened this issue Dec 20, 2023 · 6 comments
Closed

Comments

@muzimuzhi
Copy link

An example workflow: https://github.com/muzimuzhi/hello-github-actions/actions/runs/7256001370

More comparisons can be found in muzimuzhi/hello-github-actions#24. It seems changes more than a naive package upgrading are needed (I'm not a front-end developer). Also the listArtifacts() function from @actions/artifact might be helpful.

Several breaking changes were introduced in actions/upload-artifact@v4, see

@GeekyEggo
Copy link
Owner

GeekyEggo commented Dec 24, 2023

Hi @muzimuzhi, thanks for bringing this to my attention.

I've prepared a pull request (#17) that introduces support for actions/upload-artifact@v4 by utilizing the GitHub REST API; as a result of this change is the requirement of a PAT with read and write access when running the action.

@muzimuzhi
Copy link
Author

Thanks! I confirm with #17 now GeekyEggo/delete-artifact@main works as expected. 🎉

Looking forward to a v4.0.0 release.

BTW then two example.yml may be needed, one for v2 and one for v4.

@GeekyEggo
Copy link
Owner

geekyeggo/delete-artifact@v4 has been tagged and released, and the examples have been updated. 🎉

If you experience any problems, please let me know. Happy holidays.

@rolfkoizumi
Copy link

I have just upgraded our upload/download actions from @V3 to @v4 - and also tried updating this action to @v4
Out of the box, we are getting this error:
image

Exactly the same setup with all actions@v3 worked. One thing though - the actions/upload-artifact@v4 and geekyeggo/delete-artifact@v4 are in two different subsequent jobs.

I have tried:

  • using geekyeggo/delete-artifact@4.1.0
  • using geekyeggo/delete-artifact@4
  • no token parameter
  • with parameter token: ${{ github.token }} (no extra PAT created, this should use the default github token)
  • with parameter token: ${{ secrets.GITHUB_TOKEN }} (no extra PAT created, this should use the default github token)

I have then tried deleting the artifact inside the same job in a subsequent step instead of in the next job. This worked.

This is the upload-step in one job:
image
And this is the delete-step in a subsequent job:
image
I have checked that the name is exactly the same in the upload and delete step.

I'd greatly appreciate any ideas to what I'm doing wrong.

@muzimuzhi
Copy link
Author

@rolfboom Seems like related to workflow permissions, see a similar post https://github.com/orgs/community/discussions/60820.

BTW, better to raise a new issue.

@Bouni
Copy link

Bouni commented Feb 16, 2024

For me the solution was to add actions: write

deploy:
  name: "Deploy"
  runs-on: ubuntu-20.04
  permissions:
      actions: write
  steps:
     - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4
      # delete-artifact
      - name: Clean
        uses: geekyeggo/delete-artifact@v4
        with:
          name: github-pages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants