Skip to content

Update Apps List

Update Apps List #497

name: Update Apps List
on:
push:
branches: [ main ]
schedule:
- cron: '0 0 * * *' # Run daily at midnight UTC
workflow_dispatch: # Allow manual trigger
jobs:
update-readme:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for git log
- name: Update README with apps list
run: |
# Create temporary file for the new apps list
echo "## 📱 Available Apps" > apps_section.md
echo "" >> apps_section.md
echo "| App | Source | Last Updated |" >> apps_section.md
echo "|-----|--------|--------------|" >> apps_section.md
# Find all index.html files, excluding node_modules
for app_path in $(find . -name "index.html" -not -path "*/node_modules/*" -not -path "*/.git/*"); do
# Get the app directory name
app_dir=$(dirname "$app_path")
app_name=$(basename "$app_dir")
last_updated=$(git log -1 --format="%as" "$app_dir")
# Skip if it's the root directory
if [ "$app_dir" = "." ]; then
continue
fi
# Create the deployment URL (using GitHub Pages format)
deploy_url="https://pollinations.github.io/hive/main/$app_name/"
# Add the app to the list
echo "| [$app_name]($deploy_url) | [$app_dir]($app_dir) | $last_updated |" >> apps_section.md
done
# Update README.md using awk for more precise section replacement
awk '
BEGIN { printing = 1; first_apps = 1 }
/^## 📱 Available Apps/ {
if (first_apps) {
# First occurrence: insert new content
system("cat apps_section.md")
first_apps = 0
printing = 0
next
} else {
# Skip additional occurrences
printing = 0
next
}
}
/^##[^#]/ {
if (!printing) {
printing = 1
}
}
printing { print }
' README.md > README.md.tmp && mv README.md.tmp README.md
rm apps_section.md
- name: Commit and push if changed
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add README.md
git diff --quiet && git diff --staged --quiet || (git commit -m "docs: Update apps list in README [skip ci]" && git push)