Skip to content

Add Tutorial Sync Script and GitHub Actions workflow - #990

Merged
fsimonis merged 2 commits into
precice:hugofrom
MuhammadAashirAslam:sync_tutorials
Oct 8, 2026
Merged

fsimonis merged 2 commits into
precice:hugofrom
MuhammadAashirAslam:sync_tutorials

Conversation

@MuhammadAashirAslam

Copy link
Copy Markdown
Collaborator

Add sync_tutorials script and workflow

Updates the tutorials in module.toml by using a temporary directory to shallow-clone precice/tutorials, discovers all tutorial cases and their image folders, and updates the Hugo mounts alphabetically. The workflow then opens an automated PR when changes are detected.

Testing:

Reference #979 (comment)

@fsimonis

fsimonis commented Oct 5, 2026

Copy link
Copy Markdown
Member

For clarification regarding #979 (comment) I think this file is pretty much unmaintainable unless there is a way to generate it. And by this I mean generate entirely.
So you should be able to update the hugo modules, then delete the modules.toml and generate an updated one using a script.
The tutorials repo is only a part of it.

That said, the real issue is that this file is gigantic.
Is it possible to split it up into multiple files? Maybe even one for each external repository?
Then they could be updated individually, and only a script for the complicated tutorials repo would be necessary.

Regarding the technical side, I suggest generating a Python dict with all the info and then using toml.dumps to generate the corresponding toml content.

@MakisH

MakisH commented Oct 5, 2026

Copy link
Copy Markdown
Member

I like the idea of one file per repository.

For the tutorials, I see that it is mostly duplication, so that should be easy to generate: each README.md corresponds to an _index.md, and we currently only have one page per tutorial. There is already a rather consistent structure there.

However, I don't see the reason for completely auto-generating the file. There are aspects here that need human input: for example, that tutorials/tests/README.md is mounted at content/docs/dev-docs/system-tests/_index.md. We could get more pages like these, and we should be free to define where they get mounted to.

There are also pages that are inconsistent across repositories, and I would expect that more could appear at times if we integrate more contributed repositories. For example:

  • docs/adapter-calculix-overview.md
  • docs/adapter-code_aster.md
  • docs/overview.md
  • docs/adapter-fenics.md

are all meant to be mounted to some _index.md.

To me, such a long file is not an issue, as long as it is clear how to update it. Things could be further automated and made consistent (and I am happy to come up with conventions and apply them), but I would not wait for that before we can merge the rest.

@MakisH MakisH added the technical Technical issues on the website label Oct 5, 2026
@MuhammadAashirAslam

Copy link
Copy Markdown
Collaborator Author

I checked the Hugo configuration behavior and documentation, but unfortunately splitting this across multiple files isn't supported natively.

In Hugo's configuration directory, filenames in config/_default/ map directly to root configuration keys (e.g. module.toml maps to [module]). Hugo doesn't append or merge slice/array structures like [[module.imports]] across multiple files—any custom file like tutorials.toml would just be treated as an unrecognized top-level key.

The only workaround would be keeping separate files per repository and writing a custom script to stitch/concatenate them into module.toml during CI/build, but this seems a little bit too hacky and it doesnot seem a right step to me.

@fsimonis

fsimonis commented Oct 8, 2026

Copy link
Copy Markdown
Member

unfortunately splitting this across multiple files isn't supported natively.

This is really unfortunate.

Then I suggest the following:

  • please remove the workflow part of this PR, as it needs to be manual anyways.
  • then merge this PR with the tool you propose, so that we have something to work with.

@fsimonis
fsimonis merged commit 0f2832b into precice:hugo Oct 8, 2026
2 checks passed
@fsimonis fsimonis mentioned this pull request Oct 8, 2026
6 tasks done
MakisH pushed a commit that referenced this pull request Oct 20, 2026
Co-authored-by: Frédéric Simonis <simonisfrederic@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

technical Technical issues on the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants