We have a huge repo, and we want to delete a file without cloning it in Jenkins and then committing the change?
We tried looking for any Github APIs but couldn't find anything helpful.
CodePudding user response:
You can use the Github API for this.
curl \
-X DELETE \
-H "Accept: application/vnd.github json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/contents/PATH \
-d '{"message":"my commit message","committer":{"name":"Monalisa Octocat","email":"[email protected]"},"sha":"329688480d39049927147c162b9d2deaf885005f"}'
CodePudding user response:
You can use GitHUB Codespaces for that. In GitHUB web UI: create a branch, then under the big green Code button switch from Local to Codespaces tab, and run.
You'll launch a remote dev environment in the browser, with VS Code and a terminal, and then it's business as usual: rm <filename>
, git add
, git commit
, git push
. Create and merge PR.