|
| 1 | +--- |
| 2 | +name: publish-to-pages |
| 3 | +description: 'Publish presentations and web content to GitHub Pages. Converts PPTX, PDF, HTML, or Google Slides to a live GitHub Pages URL. Handles repo creation, file conversion, Pages enablement, and returns the live URL. Use when the user wants to publish, deploy, or share a presentation or HTML file via GitHub Pages.' |
| 4 | +--- |
| 5 | + |
| 6 | +# publish-to-pages |
| 7 | + |
| 8 | +Publish any presentation or web content to GitHub Pages in one shot. |
| 9 | + |
| 10 | +## 1. Prerequisites Check |
| 11 | + |
| 12 | +Run these silently. Only surface errors: |
| 13 | + |
| 14 | +```bash |
| 15 | +command -v gh >/dev/null || echo "MISSING: gh CLI — install from https://cli.github.com" |
| 16 | +gh auth status &>/dev/null || echo "MISSING: gh not authenticated — run 'gh auth login'" |
| 17 | +command -v python3 >/dev/null || echo "MISSING: python3 (needed for PPTX conversion)" |
| 18 | +``` |
| 19 | + |
| 20 | +`pandoc` is optional (PDF conversion). Don't block on it. |
| 21 | + |
| 22 | +## 2. Input Detection |
| 23 | + |
| 24 | +Determine input type from what the user provides: |
| 25 | + |
| 26 | +| Input | Detection | |
| 27 | +|-------|-----------| |
| 28 | +| HTML file | Extension `.html` or `.htm` | |
| 29 | +| PPTX file | Extension `.pptx` | |
| 30 | +| PDF file | Extension `.pdf` | |
| 31 | +| Google Slides URL | URL contains `docs.google.com/presentation` | |
| 32 | + |
| 33 | +Ask the user for a **repo name** if not provided. Default: filename without extension. |
| 34 | + |
| 35 | +## 3. Conversion |
| 36 | + |
| 37 | +### HTML |
| 38 | +No conversion needed. Use the file directly as `index.html`. |
| 39 | + |
| 40 | +### PPTX |
| 41 | +Run the conversion script: |
| 42 | +```bash |
| 43 | +python3 SKILL_DIR/scripts/convert-pptx.py INPUT_FILE /tmp/output.html |
| 44 | +``` |
| 45 | +If `python-pptx` is missing, tell the user: `pip install python-pptx` |
| 46 | + |
| 47 | +### PDF |
| 48 | +Convert with pandoc: |
| 49 | +```bash |
| 50 | +pandoc INPUT_FILE -o /tmp/output.html --self-contained |
| 51 | +``` |
| 52 | +If pandoc is missing, tell the user to install it or provide HTML instead. |
| 53 | + |
| 54 | +### Google Slides |
| 55 | +1. Extract the presentation ID from the URL (the long string between `/d/` and `/`) |
| 56 | +2. Download as PPTX: |
| 57 | +```bash |
| 58 | +curl -L "https://docs.google.com/presentation/d/PRESENTATION_ID/export/pptx" -o /tmp/slides.pptx |
| 59 | +``` |
| 60 | +3. Then convert the PPTX using the convert script above. |
| 61 | + |
| 62 | +## 4. Publishing |
| 63 | + |
| 64 | +### Visibility |
| 65 | +Repos are created **public** by default. If the user specifies `private` (or wants a private repo), use `--private` — but note that GitHub Pages on private repos requires a Pro, Team, or Enterprise plan. |
| 66 | + |
| 67 | +### Publish |
| 68 | +```bash |
| 69 | +bash SKILL_DIR/scripts/publish.sh /path/to/index.html REPO_NAME public "Description" |
| 70 | +``` |
| 71 | + |
| 72 | +Pass `private` instead of `public` if the user requests it. |
| 73 | + |
| 74 | +The script creates the repo, pushes `index.html`, and enables GitHub Pages. |
| 75 | + |
| 76 | +## 5. Output |
| 77 | + |
| 78 | +Tell the user: |
| 79 | +- **Repository:** `https://github.com/USERNAME/REPO_NAME` |
| 80 | +- **Live URL:** `https://USERNAME.github.io/REPO_NAME/` |
| 81 | +- **Note:** Pages takes 1-2 minutes to go live. |
| 82 | + |
| 83 | +## Error Handling |
| 84 | + |
| 85 | +- **Repo already exists:** Suggest appending a number (`my-slides-2`) or a date (`my-slides-2026`). |
| 86 | +- **Pages enablement fails:** Still return the repo URL. User can enable Pages manually in repo Settings. |
| 87 | +- **PPTX conversion fails:** Tell user to run `pip install python-pptx`. |
| 88 | +- **PDF conversion fails:** Suggest installing pandoc or converting to HTML manually. |
| 89 | +- **Google Slides download fails:** The presentation may not be publicly accessible. Ask user to make it viewable or download the PPTX manually. |
0 commit comments