Closed miquelduranfrigola closed 1 year ago
Hi @GrantBirki! There is a method now in Ersilia that, given a model identifier, creates a README file and pushes it to the repository in the ersilia-os
organization: https://github.com/ersilia-os/ersilia/blob/master/ersilia/publish/metadata.py
I think this is all we need. As you suggested, we can now run a very simple python script that we can run for all models to update their README file. Something this simple did work:
from ersilia.publish.metadata import ReadmeUpdater
ru = ReadmeUpdater("eos4e40")
ru.update()
As soon as we are happy with the README file template (at the moment it is very sketchy), we will run this code for all the old models. For the new ones, we can incorporate this step at merge time (i.e. after we have approved the metadata written by the user).
I hope this sounds good!
Hi @megamanics !
As you can see, we have a way of updating the README file of a given repository based on the metadata that we have.
Retrospectively (i.e. for the old models), we can run a simple python script that updates the README file. What this script does is simply git clone
the repository, update the README.md
and then add
, commit
and push
changes back to the repo.
However, prospectively (i.e. for new models), it would be great to update the README.md
file as part of the test-model.yml
workflow: https://github.com/ersilia-os/eos-template/actions/workflows/test-model.yml . I have left a placeholder step named update-readme-file
to do exactly this.
I foresee one problem, though: I cannot use the same script that I use in the retrospective case, because if I clone, update, and then push again, another action is going to be triggered, and we will enter a recursive loop.
So I wonder if there is a way to modify a given file of a repo within an action, or to do a push
that does not trigger any action. I see that it is possible to modify files: https://github.com/marketplace/actions/update-files-on-github , but I am afraid this will not solve the recursive loop issue? Another option could be perhaps to skip the workflow if a certain commit message (for example "skip action") is found.
@miquelduranfrigola
[skip ci]
or [skip actions]
to the commit message to skip the workflow run.I had no idea you could skip CI by adding text into a commit message, who knew!
Problem: At merging time, when the action is triggered, we need to update the README. Since they're making a change to the repo, they're making a change to the action, Which could cause an infinite loop.
Solution: Add "skip CI" to their commit message will prevent an infinite loop.
Is there a way to guide users to write good README files? (Converting JSON to markdown) => Jinja template engine (Python) or Numchucks (JS) can populate variables with keys read from a metadata.json file when the repo is first initialized. (Nice to have but not a must.)