diff --git a/docs/commit_info.md b/docs/commit_info.md new file mode 100644 index 0000000000000000000000000000000000000000..c159130a006e2c06966fd6efe582c4a3598af705 --- /dev/null +++ b/docs/commit_info.md @@ -0,0 +1,11 @@ +## Latest Commit + +**Branch name:** main + +**Message:** Merge remote-tracking branch 'origin/main' + + +**Author:** alexandre.caldato + +**Date:** 2023-06-01 19:13:51 + diff --git a/generate_commit_info.py b/generate_commit_info.py new file mode 100644 index 0000000000000000000000000000000000000000..6ecb233e2e12077c5f4cb4b7a45d38cc8c0dd0d4 --- /dev/null +++ b/generate_commit_info.py @@ -0,0 +1,29 @@ +from git import Repo + + +def get_git_commit_info(repo_path): + repo = Repo(repo_path) + head_commit = repo.head.commit + branch_name = repo.active_branch.name + return { + 'branch': branch_name, + 'message': head_commit.message, + 'author': head_commit.author.name, + 'date': head_commit.committed_datetime.strftime("%Y-%m-%d %H:%M:%S") + } + + +def generate_md_file(commit_info, output_file): + with open(output_file, 'w') as file: + file.write(f"## Latest Commit\n\n") + file.write(f"**Branch name:** {commit_info['branch']}\n\n") + file.write(f"**Message:** {commit_info['message']}\n\n") + file.write(f"**Author:** {commit_info['author']}\n\n") + file.write(f"**Date:** {commit_info['date']}\n\n") + + +if __name__ == "__main__": + repo_path = '.' + output_file = 'docs/commit_info.md' + commit_info = get_git_commit_info(repo_path) + generate_md_file(commit_info, output_file) diff --git a/mkdocs.yml b/mkdocs.yml index c97182f51acbfa060a8a68cd7a073aa6d579bc17..7606ae7adf1d7a7871db22b41e15f4e2eefcd71b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1 +1,4 @@ site_name: My Docs +nav: + - Home: index.md + - Latest Commit: commit_info.md