diff --git a/.github/workflows/update-page.yml b/.github/workflows/update-page.yml deleted file mode 100644 index 65a0732..0000000 --- a/.github/workflows/update-page.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Update index.html with GitHub Repos - -on: - schedule: - - cron: '0 0-12 * * *' - workflow_dispatch: - -jobs: - update-page: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install requests - - - name: Generate repos list - run: python generate_repos_list.py - - - name: Commit and push changes - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git add index.html - git commit --allow-empty -m 'Update index.html with latest GitHub repos' - git push - - diff --git a/.github/workflows/update-repos.yml b/.github/workflows/update-repos.yml new file mode 100644 index 0000000..c08bfb3 --- /dev/null +++ b/.github/workflows/update-repos.yml @@ -0,0 +1,31 @@ +name: Update repo list + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + update-list: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: pip install requests + - name: Generate GitHub data + run: python generate_repos_list.py + - name: Commit and push changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add _data/repos.json _data/profile.json + if git diff --cached --quiet; then + echo 'No changes to commit' + else + git commit -m 'Update GitHub data' + git push + fi diff --git a/README.md b/README.md new file mode 100644 index 0000000..dbe8c31 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Pat Little's Blog + +This repository hosts my personal blog built with [Jekyll](https://jekyllrb.com/) and the `minima` theme. + +## Writing posts + +Add new markdown files to the `_posts` directory. Filenames must follow the pattern `YYYY-MM-DD-title.md` and include YAML front matter like: + +```markdown +--- +layout: post +title: "My Post Title" +--- +``` + +The content under the front matter is written in regular Markdown. + +## Updating GitHub data + +Run `python generate_repos_list.py` to fetch information about my GitHub profile and repositories. The script saves repository links to `_data/repos.json` and profile details to `_data/profile.json`. The homepage uses these files to show profile stats and links. + +## License + +Unless otherwise noted, content on this site is licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/). diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..35558d5 --- /dev/null +++ b/_config.yml @@ -0,0 +1,6 @@ +baseurl: "" +title: "Pat Little's Blog" +description: "Personal blog for sharing thoughts and projects." +theme: minima +license_name: "Creative Commons Attribution 4.0 International" +license_url: "https://creativecommons.org/licenses/by/4.0/" diff --git a/_data/profile.json b/_data/profile.json new file mode 100644 index 0000000..55c37b9 --- /dev/null +++ b/_data/profile.json @@ -0,0 +1,7 @@ +{ + "avatar_url": "https://avatars.githubusercontent.com/u/0?v=4", + "html_url": "https://github.com/PatLittle", + "followers": 0, + "organizations": [], + "achievements": [] +} diff --git a/_data/repos.json b/_data/repos.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/_data/repos.json @@ -0,0 +1 @@ +[] diff --git a/_includes/footer.html b/_includes/footer.html new file mode 100644 index 0000000..918fa24 --- /dev/null +++ b/_includes/footer.html @@ -0,0 +1,18 @@ + +

Prominent disclaimer: The views expressed here are my own, and don’t represent the opinions of my team or my employer.

+ +

+ + Creative Commons License + +
+ This work is licensed under a {{ site.license_name }}. +

+ diff --git a/_posts/2025-07-02-welcome.md b/_posts/2025-07-02-welcome.md new file mode 100644 index 0000000..a40280a --- /dev/null +++ b/_posts/2025-07-02-welcome.md @@ -0,0 +1,6 @@ +--- +layout: post +title: "Welcome to My Blog" +--- + +This is the first post on my new Jekyll-powered blog. Stay tuned for more content! diff --git a/generate_repos_list.py b/generate_repos_list.py index 667f04c..dea2d5a 100644 --- a/generate_repos_list.py +++ b/generate_repos_list.py @@ -1,51 +1,78 @@ -import requests import json +import re +from pathlib import Path + +import requests + +USER = "PatLittle" +REPOS_OUTPUT = Path("_data/repos.json") +PROFILE_OUTPUT = Path("_data/profile.json") + -def fetch_repos(user): +def fetch_repos(user: str): url = f"https://api.github.com/users/{user}/repos" response = requests.get(url) - return response.json() - -def generate_html(repos): - - html_content = """ - - - - - Pat Little's Blog - - - -
-

Welcome to Pat Little's Blog

- -
-
-
-

About Me

-

Hi, I'm Pat Little. Welcome to my personal blog where I share my projects and ideas.

-
- """ - html_content += "

Repositories owned by User:PatLittle

\n" - html_content += "\n" - return html_content - -def save_html(content, filename): - with open(filename, "w") as file: - file.write(content) + response.raise_for_status() + return [ + {"name": repo["name"], "html_url": repo["html_url"]} + for repo in response.json() + ] + + +def save_repos(repos, path: Path): + path.parent.mkdir(parents=True, exist_ok=True) + with open(path, "w", encoding="utf-8") as f: + json.dump(repos, f, indent=2) + + +def fetch_profile(user: str): + url = f"https://api.github.com/users/{user}" + response = requests.get(url) + response.raise_for_status() + data = response.json() + return { + "avatar_url": data.get("avatar_url"), + "html_url": data.get("html_url"), + "followers": data.get("followers"), + } + + +def fetch_organizations(user: str): + url = f"https://api.github.com/users/{user}/orgs" + response = requests.get(url) + response.raise_for_status() + orgs = [] + for org in response.json(): + orgs.append({"login": org.get("login"), "html_url": f"https://github.com/{org.get('login')}"}) + return orgs + + +def fetch_achievements(user: str): + url = f"https://github.com/users/{user}/achievements" + response = requests.get(url) + response.raise_for_status() + alts = re.findall(r'alt="([^"]+)"', response.text) + achievements = [] + for alt in alts: + if alt and alt not in achievements and "avatar" not in alt.lower(): + achievements.append(alt) + return achievements + + +def save_profile_data(profile: dict, orgs, achievements, path: Path): + data = dict(profile) + data["organizations"] = orgs + data["achievements"] = achievements + path.parent.mkdir(parents=True, exist_ok=True) + with open(path, "w", encoding="utf-8") as f: + json.dump(data, f, indent=2) + if __name__ == "__main__": - user = "PatLittle" - repos = fetch_repos(user) - html_content = generate_html(repos) - save_html(html_content, "index.html") + repos = fetch_repos(USER) + save_repos(repos, REPOS_OUTPUT) + + profile = fetch_profile(USER) + orgs = fetch_organizations(USER) + achievements = fetch_achievements(USER) + save_profile_data(profile, orgs, achievements, PROFILE_OUTPUT) diff --git a/index.html b/index.html deleted file mode 100644 index 6130ce6..0000000 --- a/index.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - Pat Little's Blog - - - -
-

Welcome to Pat Little's Blog

- -
-
-
-

About Me

-

Hi, I'm Pat Little. Welcome to my personal blog where I share my projects and ideas.

-
-

Repositories owned by User:PatLittle

- diff --git a/index.md b/index.md new file mode 100644 index 0000000..7d9aaac --- /dev/null +++ b/index.md @@ -0,0 +1,45 @@ +--- +layout: home +title: "Pat Little's Blog" +--- + +Welcome to my personal blog! Here you'll find my latest posts. + +{% if site.data.profile %} +![Profile Picture]({{ site.data.profile.avatar_url }}){: style="width:150px;border-radius:50%;" } + +**Followers:** {{ site.data.profile.followers }} + +{% if site.data.profile.organizations and site.data.profile.organizations | size > 0 %} +### Organizations + +{% endif %} + +{% if site.data.profile.achievements and site.data.profile.achievements | size > 0 %} +### Achievements + +{% endif %} +{% endif %} + +[Connect with me on LinkedIn](https://www.linkedin.com/in/patrickjlittle/) + +## My GitHub Repositories + +{% if site.data.repos and site.data.repos | size > 0 %} + +{% else %} +

No repository data available. Run generate_repos_list.py to update.

+{% endif %} +