Files
awesome-copilot/skills/publish-to-pages/scripts/publish.sh
Andrea Liliana Griffiths 4ad31b665f Add publish-to-pages agent skill (#1035)
* Add publish-to-pages agent skill

Agent skill that publishes presentations and web content to GitHub Pages.
Works with any AI coding agent (Copilot CLI, Claude Code, Gemini CLI, etc.)

Features:
- Converts PPTX and PDF with full formatting preservation
- Creates repo, enables Pages, returns live URL
- Zero config — just needs gh CLI

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: update README.skills.md

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-17 12:49:40 +11:00

41 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Main publish script
# Args: $1 = path to index.html, $2 = repo name, $3 = visibility (private|public), $4 = description
set -euo pipefail
HTML_FILE="$1"
REPO_NAME="$2"
VISIBILITY="${3:-public}"
DESCRIPTION="${4:-Published via publish-to-pages}"
USERNAME=$(gh api user --jq '.login')
# Check if repo exists
if gh repo view "$USERNAME/$REPO_NAME" &>/dev/null; then
echo "ERROR: Repository $USERNAME/$REPO_NAME already exists"
exit 1
fi
# Create repo
gh repo create "$REPO_NAME" --"$VISIBILITY" --description "$DESCRIPTION"
# Clone, push, enable pages
TMPDIR=$(mktemp -d)
git clone "https://github.com/$USERNAME/$REPO_NAME.git" "$TMPDIR"
cp "$HTML_FILE" "$TMPDIR/index.html"
cd "$TMPDIR"
git add index.html
git commit -m "Publish content"
git push origin main
# Enable GitHub Pages
gh api "repos/$USERNAME/$REPO_NAME/pages" -X POST -f source[branch]=main -f source[path]=/ 2>/dev/null || true
echo "REPO_URL=https://github.com/$USERNAME/$REPO_NAME"
echo "PAGES_URL=https://$USERNAME.github.io/$REPO_NAME/"
echo ""
echo "GitHub Pages may take 1-2 minutes to deploy."
# Cleanup
rm -rf "$TMPDIR"