Skip to content

Save commit

Save commit #9

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 | Screenshots | 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 ', ' -)
screenshots=$(grep -A 1 '^screenshots:' $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 ', ' -)
screenshots_md=$(echo $screenshots | sed 's/ /<br>![](/g' | sed 's/^/![](/' | sed 's/$/)/')
echo "| [$title]($file) | $description | $status | $contributors | $tech | $screenshots_md | $tags |" >> index.md
done
- 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