ForceCommit commits every change while skipping CI.
( ctx context.Context, msg string, noVerify bool, authorName, authorEmail string, )
| 95 | |
| 96 | // ForceCommit commits every change while skipping CI. |
| 97 | func ForceCommit( |
| 98 | ctx context.Context, |
| 99 | msg string, |
| 100 | noVerify bool, |
| 101 | authorName, authorEmail string, |
| 102 | ) *exec.Cmd { |
| 103 | if msg == "" { |
| 104 | msg = defaultCommitMessage |
| 105 | } |
| 106 | |
| 107 | cmd := exec.CommandContext( |
| 108 | ctx, |
| 109 | "git", |
| 110 | "commit", |
| 111 | "-m", |
| 112 | msg, |
| 113 | ) |
| 114 | |
| 115 | if noVerify { |
| 116 | cmd.Args = append( |
| 117 | cmd.Args, |
| 118 | "--no-verify") |
| 119 | } |
| 120 | |
| 121 | if authorName != "" || authorEmail != "" { |
| 122 | cmd.Args = append( |
| 123 | cmd.Args, |
| 124 | fmt.Sprintf("--author=\"%s <%s>\"", authorName, authorEmail)) |
| 125 | } |
| 126 | |
| 127 | return cmd |
| 128 | } |