DeleteFile action results in 404 when file exists

Aperta
#371 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
28/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
github, github-actions, javascript, typescript
Ambito
api, devops

Direzione di ricerca

Start with the getContent and deleteFile calls shown in the issue, then compare their path, branch, and SHA values with the working curl request. Check how github-script version 6.4 sends these parameters. Done means deletion succeeds on my_branch or the request mismatch is isolated and documented.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

question

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

Lingua principale
TypeScript
Stelle
5k
Fork
586
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di actions/github-script

Tutte le issue di actions/github-script

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.