19 Commits

Author SHA1 Message Date
9a9228bc07 Merge pull request 'repo_work_fix' (#2) from repo_work_fix into master
Reviewed-on: #2
2025-05-30 17:47:31 +10:00
2dd371408f trying for the hard fix 2025-05-30 17:25:13 +10:00
0005ad1fd3 hard reset for the repo work 2025-05-30 17:20:58 +10:00
446978704d further directory cleanup 2025-01-24 04:51:50 +00:00
f24bd5b361 cleanup directory 2025-01-24 04:44:23 +00:00
4d5c27cfaa clean up 2025-01-24 04:42:04 +00:00
d45f0be314 env set up for remote 2025-01-24 04:41:14 +00:00
e1a24aff20 get rid of think tags 2025-01-24 02:17:05 +00:00
=
c2ee21abfc playing with deepseek 2025-01-22 11:43:26 +11:00
20c2a7e335 testing 2024-11-26 00:20:03 +10:00
0314472620 build: Add REPO_OWNER and REPO_NAME 2024-11-23 21:52:17 +10:00
d9356fd4fa Here's an updated version of the script that includes error handling and better output formatting:
```python
import os
import sys
from git import Repo, GitCommandError

def clone_repo(repo_url, branch="main"):
    try:
        Repo.clone_from(repo_url, ".", branch=branch)
    except GitCommandError as e:
        print(f"Error cloning repository: {e}")
        sys.exit(1)

def create_markdown_file(file_name, content):
    try:
        with open(f"{file_name}.md", "w") as f:
            f.write(content)
    except IOError as e:
        print(f"Error creating Markdown file: {e}")
        sys.exit(1)

def commit_and_push(file_name, message):
    repo = Repo(".")
    try:
        repo.index.add([f"{file_name}.md"])
        repo.index.commit(message)
        repo.remote().push()
    except GitCommandError as e:
        print(f"Error committing and pushing changes: {e}")
        sys.exit(1)

def create_new_branch(branch_name):
    repo = Repo(".")
    try:
        repo.create_head(branch_name).checkout()
        repo.head.reference.set_tracking_url(
            f"https://your_git_server/{REPO_OWNER}/{REPO_NAME}.git/{branch_name}"
        )
        repo.remote().push()
    except GitCommandError as e:
        print(f"Error creating new branch: {e}")
        sys.exit(1)

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print("Usage: python push_markdown.py <repo_url> <markdown_file_name>")
        sys.exit(1)

    repo_url = sys.argv[1]
    file_name = sys.argv[2]

    # Clone the repository
    clone_repo(repo_url)

    # Create a new Markdown file with content
    create_markdown_file(file_name, "Hello, World!\n")

    print(f"Created '{file_name}.md' successfully.")

    # Commit and push changes to the main branch
    commit_and_push(file_name, f"Add {file_name}.md")
    print("Changes committed and pushed to main branch.")

    # Create a new branch named after the Markdown file
    create_new_branch(file_name)
    print(f"Successfully created '{file_name}' branch with '{file_name}.md'.")
```

Now, the script includes error handling for cloning the repository, creating the Markdown file, committing and pushing changes, and creating a new branch. It also provides better output formatting by printing success messages after each step.

To use this updated script, run it from the command line like this:

```bash
python push_markdown.py https://your_git_server/username/repo.git my_new_file
```

This will clone the repository, create a new Markdown file named `my_new_file.md`, commit and push changes to the main branch, create a new branch named `my_new_file`, and print success messages for each step.
2024-11-23 21:50:26 +10:00
1bd0ae9b1b untested ollama 2024-11-14 17:48:11 +10:00
675c7d1701 feat: Create OllamaGenerator class for Pelican markdown generation 2024-11-13 22:41:53 +10:00
858f7c8d0a tril now gives me back a title and content of blogs 2024-11-12 23:29:11 +10:00
72a8428271 playing with tril api 2024-11-12 15:59:59 +10:00
bf40e4a3ca set up for proper repo crap 2024-11-11 20:23:18 +10:00
b72d422746 set up initial container 2024-11-07 17:42:47 +10:00
8d4bfc6e7e initial 2024-11-07 17:25:43 +10:00