Repository: PowerGridModel/power-grid-model (language: cpp)

Issue:
[FEATURE] Action to check that the generated code is up to date
- the `code_generation/` directory contains the code generator including its configuration.
- It is important that the generated code is up to date. i.e.:
  - no manual code changes were made to generated files; generated files should remain generated
  - the generated files are up to date with the latest code generator including its input configuration

This issue is about adding a github action check that that is indeed the case.

## TODO

* [x] Update all files in the `code_generation/templates/` directory
  * [x] Those files currently contain the string `This header file is automatically generated. DO NOT modify it manually!`
  * [x] There is at least one CPP file that is clearly not a header file but does contain the string `header`. That is clearly wrong (as it's not a header but a CPP file)
  * [x] Instead, the string should be: `This file is automatically generated. DO NOT modify it manually!`
  * [x] Run the `code_generation/code_gen.py` file to update all generated files and check them in
* [x] Create the github action
  * [x] Install all dependencies (found in `code_generation/requirements.txt`)
  * [x] Run `code_generation/code_gen.py`
  * [x] Check that the `git status` is empty
    * [x] should pass if it is empty
    * [x] should fail action if it isn't empty and list the changed files
    * [x] look up the exact command in the `git` documentation to do this
  * [x] To prevent unnecessary checks, the action should only run if and only if the following checked-in files and directories are changed:
    * [x] `code_generation/`
    * [x] All files and directories that contain the string `This file is automatically generated. DO NOT modify it manually!`
      * [x] In particular, those are the files that the templates `code_generation/templates/` map to
      * [x] That is: `code_generation/templates/x/.../y.z` maps to `x/.../y.z`



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/check-code-quality.yml b/.github/workflows/check-code-quality.yml
index 85aabd328..dc3c5a0d8 100644
--- a/.github/workflows/check-code-quality.yml
+++ b/.github/workflows/check-code-quality.yml
@@ -75,3 +75,18 @@ jobs:
             git status --porcelain --untracked-files=no
             exit 1
           fi
+      
+      - name: Check generated code
+        if: success()
+        run: |
+          pip install -r code_generation/requirements.txt
+          python code_generation/code_gen.py
+          if [ -n "$(git status --porcelain)" ]; then
+            echo
+            echo "The following files are outdated or were manually updated:"
+            git status --porcelain
+            exit 1
+          else
+            echo
+            echo "All the generated files are up to date."
+          fi
diff --git a/code_generation/templates/power_grid_model_c/power_grid_model_c/src/dataset_class_maps.cpp.jinja b/code_generation/templates/power_grid_model_c/power_grid_model_c/src/dataset_class_maps.cpp.jinja
index ff9ff3b7d..ed849f3db 100644
--- a/code_generation/templates/power_grid_model_c/power_grid_model_c/src/dataset_class_maps.cpp.jinja
+++ b/code_generation/templates/power_grid_model_c/power_grid_model_c/src/dataset_class_maps.cpp.jinja
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: MPL-2.0
 
-// This header file is automatically generated. DO NOT modify it manually!
+// This file is automatically generated. DO NOT modify it manually!
 
 // clang-format off
 
diff --git a/power_grid_model_c/power_grid_model_c/src/dataset_definitions.cpp b/power_grid_model_c/power_grid_model_c/src/dataset_definitions.cpp
index 70bd343b9..52951134e 100644
--- a/power_grid_model_c/power_grid_model_c/src/dataset_definitions.cpp
+++ b/power_grid_model_c/power_grid_model_c/src/dataset_definitions.cpp
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: MPL-2.0
 
-// This header file is automatically generated. DO NOT modify it manually!
+// This file is automatically generated. DO NOT modify it manually!
 
 // clang-format off
 


Test patch: