From 163258386616a8eaecc217fc56133449b8008bbe Mon Sep 17 00:00:00 2001
From: Tom Fuertes
Date: Wed, 4 Aug 2021 10:32:13 -0500
Subject: [PATCH 1/5] add skip_verification
---
README.md | 2 ++
action.yml | 4 ++++
src/git.js | 8 ++++----
src/index.js | 5 +++--
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 724c20dc..f3a7ed33 100644
--- a/README.md
+++ b/README.md
@@ -267,6 +267,8 @@ jobs:
+- **`skip_verification`:** Appends --no-verify to commit and push actions. Default: `false`
+
- **`git_name`**: Username for auto-fix commits. Default: `"Lint Action"`
- **`git_email`**: Email address for auto-fix commits. Default: `"lint-action@samuelmeuli.com"`
diff --git a/action.yml b/action.yml
index fc4c5182..2af5bd93 100644
--- a/action.yml
+++ b/action.yml
@@ -15,6 +15,10 @@ inputs:
description: Whether linters should try to fix code style issues automatically
required: false
default: "false"
+ skip_verification:
+ description: 'Appends --no-verify to commit and push actions'
+ required: false
+ default: "false"
git_name:
description: Username for auto-fix commits
required: false
diff --git a/src/git.js b/src/git.js
index cb4ebcad..e919da6c 100644
--- a/src/git.js
+++ b/src/git.js
@@ -39,9 +39,9 @@ function checkOutRemoteBranch(context) {
* Stages and commits all changes using Git
* @param {string} message - Git commit message
*/
-function commitChanges(message) {
+function commitChanges(message, skipVerification) {
core.info(`Committing changes`);
- run(`git commit -am "${message}"`);
+ run(`git commit -am "${message}"${skipVerification ? " --no-verify" : ""}`);
}
/**
@@ -68,9 +68,9 @@ function hasChanges() {
/**
* Pushes all changes to the remote repository
*/
-function pushChanges() {
+function pushChanges(skipVerification) {
core.info("Pushing changes with Git");
- run("git push");
+ run(`git push${skipVerification ? " --no-verify" : ""}`);
}
/**
diff --git a/src/index.js b/src/index.js
index 0e4c6d8b..4821057c 100644
--- a/src/index.js
+++ b/src/index.js
@@ -14,6 +14,7 @@ const { getSummary } = require("./utils/lint-result");
async function runAction() {
const context = getContext();
const autoFix = core.getInput("auto_fix") === "true";
+ const skipVerification = core.getInput("skip_verification") === "true";
const continueOnError = core.getInput("continue_on_error") === "true";
const gitName = core.getInput("git_name", { required: true });
const gitEmail = core.getInput("git_email", { required: true });
@@ -98,8 +99,8 @@ async function runAction() {
if (autoFix) {
// Commit and push auto-fix changes
if (git.hasChanges()) {
- git.commitChanges(commitMessage.replace(/\${linter}/g, linter.name));
- git.pushChanges();
+ git.commitChanges(commitMessage.replace(/\${linter}/g, linter.name), skipVerification);
+ git.pushChanges(skipVerification);
}
}
From 513be9b741b12509777f35663926fa71f1eb3afc Mon Sep 17 00:00:00 2001
From: Tom Fuertes
Date: Mon, 9 Aug 2021 10:49:20 -0500
Subject: [PATCH 2/5] Update action.yml
Co-authored-by: Dominik Schilling
---
action.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/action.yml b/action.yml
index 2af5bd93..00ef7aa8 100644
--- a/action.yml
+++ b/action.yml
@@ -15,8 +15,8 @@ inputs:
description: Whether linters should try to fix code style issues automatically
required: false
default: "false"
- skip_verification:
- description: 'Appends --no-verify to commit and push actions'
+ git_no_verify:
+ description: Bypass the pre-commit and pre-push git hooks
required: false
default: "false"
git_name:
From 69d320c424c822eafcc79dfd9e491535b5a61118 Mon Sep 17 00:00:00 2001
From: Tom Fuertes
Date: Mon, 9 Aug 2021 10:51:09 -0500
Subject: [PATCH 3/5] propogate config flag suggestion
---
README.md | 2 +-
src/index.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index f3a7ed33..9f09958d 100644
--- a/README.md
+++ b/README.md
@@ -267,7 +267,7 @@ jobs:
-- **`skip_verification`:** Appends --no-verify to commit and push actions. Default: `false`
+- **`git_no_verify`:** Bypass the pre-commit and pre-push git hooks. Default: `false`
- **`git_name`**: Username for auto-fix commits. Default: `"Lint Action"`
diff --git a/src/index.js b/src/index.js
index 4821057c..1880a304 100644
--- a/src/index.js
+++ b/src/index.js
@@ -14,7 +14,7 @@ const { getSummary } = require("./utils/lint-result");
async function runAction() {
const context = getContext();
const autoFix = core.getInput("auto_fix") === "true";
- const skipVerification = core.getInput("skip_verification") === "true";
+ const skipVerification = core.getInput("git_no_verify") === "true";
const continueOnError = core.getInput("continue_on_error") === "true";
const gitName = core.getInput("git_name", { required: true });
const gitEmail = core.getInput("git_email", { required: true });
From fdebc5f58f29437b6acf9eab865ded00ac19f090 Mon Sep 17 00:00:00 2001
From: Tom Fuertes
Date: Mon, 9 Aug 2021 11:01:11 -0500
Subject: [PATCH 4/5] add jsdoc
---
src/git.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/git.js b/src/git.js
index e919da6c..f05872aa 100644
--- a/src/git.js
+++ b/src/git.js
@@ -38,6 +38,7 @@ function checkOutRemoteBranch(context) {
/**
* Stages and commits all changes using Git
* @param {string} message - Git commit message
+ * @param {boolean} skipVerification - Skip Git verification
*/
function commitChanges(message, skipVerification) {
core.info(`Committing changes`);
@@ -67,6 +68,7 @@ function hasChanges() {
/**
* Pushes all changes to the remote repository
+ * @param {boolean} skipVerification - Skip Git verification
*/
function pushChanges(skipVerification) {
core.info("Pushing changes with Git");
From aed39c5b342d995887abe407fa9ecfb2ce4ead74 Mon Sep 17 00:00:00 2001
From: Dominik Schilling
Date: Tue, 10 Aug 2021 09:07:27 +0200
Subject: [PATCH 5/5] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 9f09958d..46dd8727 100644
--- a/README.md
+++ b/README.md
@@ -267,12 +267,12 @@ jobs:
-- **`git_no_verify`:** Bypass the pre-commit and pre-push git hooks. Default: `false`
-
- **`git_name`**: Username for auto-fix commits. Default: `"Lint Action"`
- **`git_email`**: Email address for auto-fix commits. Default: `"lint-action@samuelmeuli.com"`
+- **`git_no_verify`**: Bypass the pre-commit and pre-push git hooks. Default: `false`
+
- **`commit_message`**: Template for auto-fix commit messages. The `${linter}` variable can be used to insert the name of the linter. Default: `"Fix code style issues with ${linter}"`
- **`check_name`**: Template for the [name of the check run](https://docs.github.com/en/rest/reference/checks#create-a-check-run). Use this to ensure unique names when the action is used more than once in a workflow. The `${linter}` and `${dir}` variables can be used to insert the name and directory of the linter. Default: `"${linter}"`