Compare commits

...

2 Commits

Author SHA1 Message Date
Tiago Garcia 5339c1f791
Update README.md
Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
2024-07-19 11:59:01 +01:00
Tiago Garcia 10e5243cc4
Add actions to response
Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
2024-07-19 11:58:53 +01:00
2 changed files with 9 additions and 5 deletions

View File

@ -32,11 +32,9 @@ You can see the config file format below.
git clone https://github.com/TiagoRG/gh-wh-handler.git
```
2. Create the build directory:
2. Move to the build directory:
```console
cd gh-wh-handler
mkdir build
cd build
cd gh-wh-handler/build
```
3. Run CMake:

View File

@ -121,7 +121,11 @@ crow::response update_files(const nlohmann::json& config_update_files, const nlo
{"status", 200},
{"message", "OK"},
{"file_count", 0},
{"updated-files", nlohmann::json::array()}
{"updated-files", nlohmann::json::array()},
{"post-update", {
{"successful", nlohmann::json::array()},
{"failed", nlohmann::json::array()}
}}
};
for (auto &file : modified_files) {
std::string remote_path = file[0];
@ -151,8 +155,10 @@ crow::response update_files(const nlohmann::json& config_update_files, const nlo
int return_code = std::system(action.c_str());
if (return_code == 0) {
Logger::success("[/update-files] Post-update action " + action + " ran successfully");
response["post-update"]["successful"].push_back(action);
} else {
Logger::error("[/update-files] Post-update action " + action + " failed with return code " + std::to_string(return_code));
response["post-update"]["failed"].push_back(action);
}
}