Commit Graph
30 Commits
Author SHA1 Message Date
armistace d6d3e2f3af env set up for remote 2025-05-30 16:56:15 +10:00
armistace 0fc39350b0 fixing more merge conflicts 2025-05-30 16:55:11 +10:00
armistace 0e71556c15 env vars and starting work on repo_manager 2025-05-30 16:54:00 +10:00
armistace ce24a011ed cleanup directory 2025-05-30 16:45:39 +10:00
armistace ae96075275 env set up for remote 2025-05-30 16:45:03 +10:00
armistace 641f11e0aa get rid of think tags 2025-05-30 16:44:31 +10:00
armistace 7c724d8177 merge conflict fixing finalisation 2025-05-30 16:36:18 +10:00
armistace b87dc1da9e merge fix 2025-05-30 16:02:37 +10:00
armistace a3db1ae993 env vars and starting work on repo_manager 2025-05-30 16:00:54 +10:00
armistace 9b57e2b9ea further directory cleanup 2025-05-30 15:42:30 +10:00
armistace 20233b6264 cleanup directory 2025-05-30 15:42:29 +10:00
armistace 4e65c60611 env set up for remote 2025-05-30 15:41:59 +10:00
armistace d91d82b281 fixing more merge conflicts 2025-05-30 15:40:42 +10:00
armistace 9e9ac7b99d finished repo work 2025-05-30 15:17:52 +10:00
armistace 328e870bf0 finailising repo manager 2025-05-29 23:55:12 +10:00
armistace 546b86738a TODO: parse URL paramters correctly 2025-05-29 17:29:48 +10:00
armistace 1bb99c2343 change the .env to openthinkier as editor 2025-05-29 16:30:45 +10:00
armistace c606f72d90 env vars and starting work on repo_manager 2025-05-23 15:47:25 +10:00
armistace 8a64d9c959 fix pyrefly typuing errors 2025-05-19 11:38:15 +10:00
armistace 0c090c8489 add vscode to gitignore 2025-05-19 11:28:10 +10:00
armistace 20c2a7e335 testing 2024-11-26 00:20:03 +10:00
armistace 0314472620 build: Add REPO_OWNER and REPO_NAME 2024-11-23 21:52:17 +10:00
armistace 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
armistace 1bd0ae9b1b untested ollama 2024-11-14 17:48:11 +10:00
armistace 675c7d1701 feat: Create OllamaGenerator class for Pelican markdown generation 2024-11-13 22:41:53 +10:00
armistace 858f7c8d0a tril now gives me back a title and content of blogs 2024-11-12 23:29:11 +10:00
armistace 72a8428271 playing with tril api 2024-11-12 15:59:59 +10:00
armistace bf40e4a3ca set up for proper repo crap 2024-11-11 20:23:18 +10:00
armistace b72d422746 set up initial container 2024-11-07 17:42:47 +10:00
armistace 8d4bfc6e7e initial 2024-11-07 17:25:43 +10:00