dyne / restroom-mw

🛠 Easy REST API builder executing Zencode
https://restroom.dyne.org
GNU Affero General Public License v3.0
3 stars 11 forks source link

Then statements to add files and make a commit to a local git repository #219

Open jaromil opened 1 year ago

jaromil commented 1 year ago
Then I add the file named by 'first_file' to the git repository '/var/run/w3c_did/repo'
and I add the file '/var/run/w3c_did/repo/second_file' to the git repository named by 'w4c_did_repo'
and I commit to the git repository named by 'w4c_did_repo' using the comment in string 'my_comment'

Statements may possibly work both with hard-coded values (paths to files and repo and comment) as well with values in HEAP. The goal is to be able to add and modify files in a git repository and commit changes with a comment from Zencode.

puria commented 1 year ago

consider using https://github.com/isomorphic-git/isomorphic-git

albertolerda commented 1 year ago

For a commit it is also required the author and its email, should I change

Then I commit to the git repository '...' using the comment in string '..' by 'author' with email 'author_email'

We can also introduce a statement

Given the git author '' with email ''

which sets email and author as global for the whole script

puria commented 1 year ago

For a commit it is also required the author and its email, should I change

Then I commit to the git repository '...' using the comment in string '..' by 'author' with email 'author_email'

We can also introduce a statement

Given the git author '' with email ''

which sets email and author as global for the whole script

Can we do that email/username is the one saved in the system... like... by default is run via restroom <restoom@dyne.org> maybe configurable via ENV VARS?

@jaromil does this make sense? To fill others repository restroom commits, and make aware that are automatic commits... ????

jaromil commented 1 year ago

Just like in some statements we expect the existence of data, in this case, we can expect the existence of a configured git repository in Given and the existence of a dictionary describing all git commit fields

Given I have a git repository in 'path/to/repo` # checks .git

... Zenroom's zencode to create a dictionary in the form:
commit = { author, email, comment, files = [ ... ] }

Then I make a new commit to the git repository in 'path/to/repo'