Skip to content

Commit

Permalink
✨ Git exporter: allow passing flags to the different git commands, an…
Browse files Browse the repository at this point in the history
…d allow renaming output file
  • Loading branch information
ewen-lbh committed Apr 14, 2024
1 parent 6c1a351 commit 00cd565
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions exporters/git.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,33 @@ requires:
data:
# URL to the Git repository
url:

# Commit message used
commit:

# Where to copy the database.json file in the repository
path: database.json

# Additional flags to pass to git commit
git_commit_flags: ""

# Additional flags to pass to git push
git_push_flags: ""

# Additional flags to pass to git clone
git_clone_flags: ""

# Additional flags to pass to git add
git_add_flags: ""

after:
# - run: test ! -d .ortfodb-tmp || echo .ortfodb-tmp exists, please remove it >&2; exit 1
- log: [Cloning, blue, 'repository {{ index .Data "url" }}']
- run: git clone {{ index .Data "url" }} .ortfodb-tmp
- run: git clone {{ index .Data "git_clone_flags" }} {{ index .Data "url" }} .ortfodb-tmp
- log: [Comitting, blue, "{{ .Ctx.OutputDatabaseFile }} to the repository"]
- run: cp {{ .Ctx.OutputDatabaseFile }} .ortfodb-tmp
- run: cd .ortfodb-tmp && git add {{ .Ctx.OutputDatabaseFile }} && git commit -m '{{ index .Data "commit" }}'
- run: cp {{ .Ctx.OutputDatabaseFile }} .ortfodb-tmp/{{ index .Data "path" }}
- run: cd .ortfodb-tmp && git add {{ index .Data "git_add_flags" }} {{ index .Data "path" }} && git commit {{ index .Data "git_commit_flags" }} -m '{{ index .Data "commit" }}'
- log: [Pushing, blue, "changes to the repository"]
- run: cd .ortfodb-tmp && git push
- run: cd .ortfodb-tmp && git push {{ index .Data "git_push_flags" }}
- log: [Cleaning up, dim, ".ortfodb-tmp directory"]
- run: rm -rf .ortfodb-tmp

0 comments on commit 00cd565

Please sign in to comment.