Skip to content

Save commit

Save commit #7

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
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 ', ' -)
echo "### [$title]($file)" >> index.md
echo "**Status:** $status" >> index.md
echo "**Description:** $description" >> index.md
echo "**Contributors:** $contributors" >> index.md
echo "**Technology:** $tech" >> index.md
echo "**Screenshots:**" >> index.md
for screenshot in $screenshots; do
echo "![$screenshot]($screenshot)" >> index.md
done
echo "**Tags:** $tags" >> index.md
echo "" >> index.md
echo "---" >> 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