github-tools / github-tools/github
When writing a file: 422 (Unprocessable Entity)
- Linguagem predominante
- JavaScript
- Estrelas
- 3.8k
- Forks
- 809
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
Hello,
I am trying to write a file doing:
```javascript
new GitHub(authPayload)
.getRepo(githubUsername, repoName)
.writeFile(null, path, content, commitMessage, {
encode: true,
author: null,
committer: null
})
```
But i am getting a `422 (Unprocessable Entity)`. This is a new file, and I am seeing in the log the `404 (Not Found)` from the call trying to get the SHA which is correct ( i dont understand why this is dumped into the console tho...).
Looking online at https://developer.github.com/v3/repos/contents/#create-or-update-file-contents , it seems that when `author` and `committer` are used , then we need to specify `name` and `author`. But in my case, I would like to use the default behavior which is to use the authenticated user.
When I look at http://github-tools.github.io/github/docs/3.2.3/Repository.js.html#line750 , it seems that the keys are set. Should they not be here at all, in case they are not given in the `option` payload ?
Thank you !
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Comece em Repository.js por volta da linha 750 e acompanhe a chamada de writeFile com um arquivo novo e as opções fornecidas. Compare o payload de author e committer gerado com a documentação da GitHub Create or Update File Contents API e inspecione como a busca do SHA do arquivo ausente trata seu 404. Está concluído quando um arquivo novo puder ser escrito usando o usuário autenticado sem uma resposta 422.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript
- Domínio
- api
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100