Skip to content

DeleteFile action results in 404 when file exists #371

Open
@delia-iuga

Description

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

Metadata

Assignees

No one assigned

    Labels

    questionA question on how to use this action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions