From ece9b3947daad04cb6838668539ae7777263e7e3 Mon Sep 17 00:00:00 2001 From: Jack Leslie Date: Wed, 29 Dec 2021 18:16:37 +0000 Subject: [PATCH 1/5] custom git user option --- action.yml | 3 +++ src/index.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 61200769..cb59de12 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,9 @@ inputs: title: description: The pull request title. Default to `Version Packages` required: false + customGitUser: + description: Use a custom git user to create commits, rather than the default `"github-actions[bot]"` user. + required: false outputs: published: description: A boolean value to indicate whether a publishing is happened or not diff --git a/src/index.ts b/src/index.ts index 5f3b871a..85a373d6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,8 +14,12 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined; return; } - console.log("setting git user"); - await gitUtils.setupUser(); + let customGitUser = getOptionalInput("customGitUser"); + + if (!customGitUser) { + console.log("setting git user"); + await gitUtils.setupUser(); + } console.log("setting GitHub credentials"); await fs.writeFile( From d227ee72c3d805c2345e8994a1eed0737edc903e Mon Sep 17 00:00:00 2001 From: Jack Leslie <52004409+jacklesliewise@users.noreply.github.com> Date: Wed, 29 Dec 2021 18:19:26 +0000 Subject: [PATCH 2/5] Create two-dolls-promise.md --- .changeset/two-dolls-promise.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/two-dolls-promise.md diff --git a/.changeset/two-dolls-promise.md b/.changeset/two-dolls-promise.md new file mode 100644 index 00000000..aa391181 --- /dev/null +++ b/.changeset/two-dolls-promise.md @@ -0,0 +1,5 @@ +--- +"@changesets/action": patch +--- + +add an input option to allow custom git users From 1978e21c6423cb3bfc96c3363b59a16a1f3e9f98 Mon Sep 17 00:00:00 2001 From: Jack Leslie <52004409+jacklesliewise@users.noreply.github.com> Date: Wed, 29 Dec 2021 18:19:51 +0000 Subject: [PATCH 3/5] Update two-dolls-promise.md --- .changeset/two-dolls-promise.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/two-dolls-promise.md b/.changeset/two-dolls-promise.md index aa391181..13ae3602 100644 --- a/.changeset/two-dolls-promise.md +++ b/.changeset/two-dolls-promise.md @@ -1,5 +1,5 @@ --- -"@changesets/action": patch +"@changesets/action": minor --- add an input option to allow custom git users From 7a24be775bbc4e652f5f74c603420e860abc3ac3 Mon Sep 17 00:00:00 2001 From: Jack Leslie Date: Thu, 6 Jan 2022 23:58:16 +0000 Subject: [PATCH 4/5] change input name and update default --- .changeset/two-dolls-promise.md | 2 +- README.md | 1 + action.yml | 5 +++-- package.json | 2 +- src/index.ts | 4 ++-- yarn.lock | 17 +++++++++++++---- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.changeset/two-dolls-promise.md b/.changeset/two-dolls-promise.md index 13ae3602..06bffa45 100644 --- a/.changeset/two-dolls-promise.md +++ b/.changeset/two-dolls-promise.md @@ -2,4 +2,4 @@ "@changesets/action": minor --- -add an input option to allow custom git users +add a `setupGitUser` to enable or disable setting up a default git user diff --git a/README.md b/README.md index b64a4f0e..a506d6a6 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This action for [Changesets](https://github.com/atlassian/changesets) creates a - version - The command to update version, edit CHANGELOG, read and delete changesets. Default to `changeset version` if not provided - commit - The commit message to use. Default to `Version Packages` - title - The pull request title. Default to `Version Packages` +- setupGitUser - Sets up the git user for commits as `"github-actions[bot]"`. Default to `true` ### Outputs diff --git a/action.yml b/action.yml index cb59de12..bc0aad2b 100644 --- a/action.yml +++ b/action.yml @@ -17,9 +17,10 @@ inputs: title: description: The pull request title. Default to `Version Packages` required: false - customGitUser: - description: Use a custom git user to create commits, rather than the default `"github-actions[bot]"` user. + setupGitUser: + description: Sets up the git user for commits as `"github-actions[bot]"`. Default to `true` required: false + default: true outputs: published: description: A boolean value to indicate whether a publishing is happened or not diff --git a/package.json b/package.json index 69a644cc..aeb9cb3a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "release": "node ./scripts/release.js" }, "dependencies": { - "@actions/core": "^1.2.4", + "@actions/core": "^1.3.0", "@actions/exec": "^1.1.0", "@actions/github": "^4.0.0", "@babel/core": "^7.13.10", diff --git a/src/index.ts b/src/index.ts index 85a373d6..bd5ea021 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,9 +14,9 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined; return; } - let customGitUser = getOptionalInput("customGitUser"); + let setupGitUser = core.getBooleanInput('setupGitUser'); - if (!customGitUser) { + if (setupGitUser) { console.log("setting git user"); await gitUtils.setupUser(); } diff --git a/yarn.lock b/yarn.lock index 70cce6c7..352d1673 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,12 @@ # yarn lockfile v1 -"@actions/core@^1.2.4": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.4.tgz#96179dbf9f8d951dd74b40a0dbd5c22555d186ab" - integrity sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg== +"@actions/core@^1.3.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.6.0.tgz#0568e47039bfb6a9170393a73f3b7eb3b22462cb" + integrity sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw== + dependencies: + "@actions/http-client" "^1.0.11" "@actions/exec@^1.1.0": version "1.1.0" @@ -24,6 +26,13 @@ "@octokit/plugin-paginate-rest" "^2.2.3" "@octokit/plugin-rest-endpoint-methods" "^4.0.0" +"@actions/http-client@^1.0.11": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-1.0.11.tgz#c58b12e9aa8b159ee39e7dd6cbd0e91d905633c0" + integrity sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg== + dependencies: + tunnel "0.0.6" + "@actions/http-client@^1.0.8": version "1.0.8" resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-1.0.8.tgz#8bd76e8eca89dc8bcf619aa128eba85f7a39af45" From f4b970bba9d00a2dfad4940e3ec4fccd0392c8f6 Mon Sep 17 00:00:00 2001 From: Mitchell Hamilton Date: Fri, 7 Jan 2022 10:13:58 +1000 Subject: [PATCH 5/5] Update .changeset/two-dolls-promise.md --- .changeset/two-dolls-promise.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/two-dolls-promise.md b/.changeset/two-dolls-promise.md index 06bffa45..517e1638 100644 --- a/.changeset/two-dolls-promise.md +++ b/.changeset/two-dolls-promise.md @@ -2,4 +2,4 @@ "@changesets/action": minor --- -add a `setupGitUser` to enable or disable setting up a default git user +Added `setupGitUser` option to enable or disable setting up a default git user