Github API for updating a file content is not working for files under .github folders. Could you please suggest solution for that?

Hi All,

I facing a strange behavior here in case of updating a file content using github API.

curl API command: https://api.github.com/repos/<internal_org>/<repo_name>/contents/.github/workflows/TEST_pipeline.yml

data = {
“message”: “Updating via api”,
“content”: “base64 encoded data”,
“sha”: “sha for the file”
}

Problem: Except .github folder the file update is happening everywhere via above API call. I am receiving below error if I am doing the file updation for files under .github folder .

{“message”:“Not Found”,“documentation_url”:“https://docs.github.com/rest/reference/repos#create-or-update-file-contents”}

Error Code : 404

Can any one suggest the solution here.

Thanks

The repo scope isn’t sufficient for updating workflow files, you need to have the workflow scope, too. See Scopes for OAuth Apps - GitHub Docs.