使用表单响应触发 git 提交
Trigger git commit using form response
有什么方法可以在用户提交他们的 js 表单时触发 git 提交?我想将表单中提交的数据包含在 github 上的提交描述中。我尝试使用多个框架,但我没有成功。
堆栈:
- 我正在为 ui 使用 bootstrap 5.1。
- 在 render.com
上的静态站点上部署
如果您使用PHP,您可以使用exec
来执行命令。
基本上,您可以编写一个 REST API 来 运行 exec
函数。
例如,让我们使用Laravel
Route::post('commit', function(Request $request) {
exec('cd /to/your/folder';
exec('git add .');
exec('git commit -m "'.$request->commitMessage.'"');
exec('git push origin master');
});
有什么方法可以在用户提交他们的 js 表单时触发 git 提交?我想将表单中提交的数据包含在 github 上的提交描述中。我尝试使用多个框架,但我没有成功。
堆栈:
- 我正在为 ui 使用 bootstrap 5.1。
- 在 render.com 上的静态站点上部署
如果您使用PHP,您可以使用exec
来执行命令。
基本上,您可以编写一个 REST API 来 运行 exec
函数。
例如,让我们使用Laravel
Route::post('commit', function(Request $request) {
exec('cd /to/your/folder';
exec('git add .');
exec('git commit -m "'.$request->commitMessage.'"');
exec('git push origin master');
});