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

DeleteFile action results in 404 when file exists #371

Open
delia-iuga opened this issue Apr 20, 2023 · 1 comment
Open

DeleteFile action results in 404 when file exists #371

delia-iuga opened this issue Apr 20, 2023 · 1 comment
Labels
question A question on how to use this action

Comments

@delia-iuga
Copy link

Describe the bug
I am using the deleteFile action in one of my pipelines, the idea is to perform some cleanup after some tasks are successfully done. I am following the documentation of the method, I put all the required fields, but when is running I get a 404, file does not exist, even though the file is there. Is there something I am missing? when deleting using curl(same parameters) it works just fine. Unfortunately I can't share screenshots since is a private repo.

To Reproduce
Steps to reproduce the behavior:
I get the sha of the file I want to delete:

const file = await github.rest.repos.getContent({
                owner: context.repo.owner,
                repo: context.repo.repo,
                path: "${{ path1 }}/${{ path2 }}/file",
                ref: "my_branch"

and then I run the delete:

github.rest.repos.deleteFile({
                 owner: context.repo.owner,
                 repo: context.repo.repo,
                 path: "${{ path1 }}/${{ path2 }}/file",
                 message: "Delete file",
                 sha: file.data.sha,
                 branch: "my_branch"

Expected behavior
File is deleted on the specific branch.

Desktop (please complete the following information):

  • OS: Ubuntu

Additional context
I am using version 6.4

@joshmgross joshmgross added the question A question on how to use this action label May 1, 2023
@joshmgross
Copy link
Member

Could you share a copy of your workflow?
Does it have sufficient permissions to delete files?

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

No branches or pull requests

2 participants