github-script
github-script copied to clipboard
DeleteFile action results in 404 when file exists
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
Could you share a copy of your workflow? Does it have sufficient permissions to delete files?