Skip to content

Need help for adding a commiter and a author to a commit #11

@LHumblot

Description

@LHumblot

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: "[email protected]",
    },
    author: {
      name: "Titi titi",
      email: "[email protected]",
    },
    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: "[email protected]",
    },
    author: {
      name: "Titi titi",
      email: "[email protected]",
    },
  })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions