diff --git a/.changeset/khaki-geese-speak.md b/.changeset/khaki-geese-speak.md new file mode 100644 index 00000000..43a99ec7 --- /dev/null +++ b/.changeset/khaki-geese-speak.md @@ -0,0 +1,5 @@ +--- +"@changesets/action": minor +--- + +Added the capability to override the GitHub username used to create the PullRequest diff --git a/README.md b/README.md index cc7f703b..a1eaaff5 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ This action for [Changesets](https://github.com/atlassian/changesets) creates a - setupGitUser - Sets up the git user for commits as `"github-actions[bot]"`. Default to `true` - createGithubReleases - A boolean value to indicate whether to create Github releases after `publish` or not. Default to `true` - cwd - Changes node's `process.cwd()` if the project is not located on the root. Default to `process.cwd()` +- gitHubUser - Sets the GitHub user that will author the PR, defaults to `"github-actions[bot]"` ### Outputs diff --git a/src/index.ts b/src/index.ts index 194204dc..1532f1d8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,9 +28,10 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined; } core.info("setting GitHub credentials"); + const gitHubUser = core.getInput("gitHubUser") ? core.getInput("gitHubUser") : "github-actions[bot]"; await fs.writeFile( `${process.env.HOME}/.netrc`, - `machine github.com\nlogin github-actions[bot]\npassword ${githubToken}` + `machine github.com\nlogin ${gitHubUser}\npassword ${githubToken}` ); let { changesets } = await readChangesetState();