Need help for adding a commiter and a author to a commit
LHumblot opened this issue · 5 comments
Hello everybody.
In a project a try to use octokit-commit-multiple-files. Its working well but i would like to add in my commit an author and a commiter. I manage to do this when i use the function createOrUpdateFileContents by adding a commiter and an author in the options but with the same options in createOrUpdateFiles function is not working. I think i do something wrong, can you help me to find the solution.
Thanks a lot for your help.
Lionel
here is my code
toto = {
"data/test.md": `# This is a testI hope it works`,
"man/test2.md": {
contents: file,
},
};
const branchName = await octokit.repos.createOrUpdateFiles({
owner: "XXXX",
repo: "XXXX",
branch: "master",
createBranch: true,
committer: {
name: `Toto toto`,
email: "toto@toto.fr",
},
author: {
name: "Titi titi",
email: "ltiti@titi.frr",
},
changes: [
{
message: "Your commit message",
files: toto,
},
],
});
and the working well code for createOrUpdateFileContents function
const { data } = await octokit.repos.createOrUpdateFileContents({
// replace the owner and email with your own details
owner: "XXXX",
repo: "XXXX",
path: "data/test3.md",
message: "add a commitercommiter",
content: file,
committer: {
name: `Toto toto`,
email: "toto@toto.fr",
},
author: {
name: "Titi titi",
email: "ltiti@titi.frr",
},
})
Hey @LHumblot, thanks for raising this! The plugin does not currently support the committer
and author
fields.
I'd love to see a pull request adding this functionality. The information needs to be added to the createCommit
call in https://github.com/mheap/octokit-commit-multiple-files/blob/master/create-or-update-files.js#L151-L158
I can see the author
and committer
parameters on https://octokit.github.io/rest.js/v18#git-create-commit which will help achieve this.
Is this something you'd be willing to contribute?
Here is my solution, i hope it will be good for you.
create-or-update-files.zip
v3.2.0 is now released with these changes 🙌