Skip to content

Save commit

Save commit #10

name: Update Homepage
on:
push:
branches:
- main
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate Homepage
run: |
echo "# SkunkWorks" > index.md
echo "## Projects" >> index.md
echo "| Project Name | Description | Status | Contributors | Technology | Tags |" >> index.md
echo "|--------------|-------------|--------|--------------|------------|------|" >> index.md
for file in projects/*.md; do
if [[ $file == "projects/_template.md" ]]; then
continue
fi
title=$(grep -m 1 '^title:' $file | cut -d '"' -f 2)
description=$(grep -m 1 '^description:' $file | cut -d '"' -f 2)
status=$(grep -m 1 '^status:' $file | cut -d '"' -f 2)
contributors=$(grep '^ - ' $file | cut -d '"' -f 2 | paste -sd ', ' -)
tech=$(grep -A 1 '^technology:' $file | tail -n +2 | grep -v '^---' | sed 's/ - //g' | paste -sd ', ' -)
tags=$(grep -A 1 '^tags:' $file | tail -n +2 | grep -v '^---' | sed 's/ - //g' | paste -sd ', ' -)
echo "| [$title]($file) | $description | $status | $contributors | $tech | $tags |" >> index.md
done
echo "[Add a New Project](https://github.com/[your-username]/hobby-projects/new/main/projects)" >> index.md
- name: Commit changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add index.md
git commit -m "Automatically update homepage with project details and tech stack"
git push