-
Notifications
You must be signed in to change notification settings - Fork 27
feat: added skill to deploy to github pages using pfcli #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dlabaj
wants to merge
1
commit into
patternfly:main
Choose a base branch
from
dlabaj:deploy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| --- | ||
| name: pf-github-pages-deploy | ||
| description: Deploy a PatternFly React project to GitHub Pages using pfcli deploy. Use when publishing a prototype, sharing a demo URL, deploying to GitHub Pages, or when the user mentions pfcli deploy. | ||
| --- | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just agreeing with the coderabbit comment. CONTRIBUTING-SKILLS.md calls this out specifically for skills that deploy. Without it, the AI could auto-invoke a deployment when someone casually mentions "deploy" or "GitHub Pages." |
||
|
|
||
| # Deploy to GitHub Pages with pfcli | ||
|
|
||
| Build the project and publish it to GitHub Pages with a single command. `pfcli deploy` runs the build, configures asset paths for project pages, enables GitHub Pages when possible, and pushes to the `gh-pages` branch. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Verify before deploying: | ||
|
|
||
| 1. **PatternFly CLI** — `pfcli --version` or `patternfly-cli --version`. If missing, install from [patternfly/patternfly-cli](https://github.com/patternfly/patternfly-cli). | ||
| 2. **GitHub CLI** — `gh auth status` must show a logged-in account with repo access. | ||
| 3. **Git remote** — the project must have an `origin` remote pointing at GitHub (`git remote get-url origin`). If missing, run `pfcli init` first. | ||
| 4. **Build script** — `package.json` must define a `build` script unless deploying prebuilt output with `--no-build`. | ||
|
|
||
| Run from the project root (or pass the path as the final argument). | ||
|
|
||
| ## Deploy workflow | ||
|
|
||
| ```text | ||
| Task progress: | ||
| - [ ] Confirm prerequisites | ||
| - [ ] Commit or stash uncommitted work if the user wants a clean deploy | ||
| - [ ] Run pfcli deploy | ||
| - [ ] Share the live URL with the user | ||
| ``` | ||
|
|
||
| ### Step 1: Confirm the project is ready | ||
|
|
||
| From the project root: | ||
|
|
||
| ```bash | ||
| test -f package.json && git remote get-url origin | ||
| gh auth status | ||
| ``` | ||
|
|
||
| If there is no GitHub remote, run `pfcli init` in the project directory and follow its prompts to create or connect a repository. | ||
|
|
||
| If the user has uncommitted changes they want on GitHub before deploying, run `pfcli save` first. | ||
|
|
||
| ### Step 2: Deploy | ||
|
|
||
| Default deploy (build + publish `dist/` to `gh-pages`): | ||
|
|
||
| ```bash | ||
| pfcli deploy | ||
| ``` | ||
|
|
||
| Common options: | ||
|
|
||
| | Flag | Purpose | | ||
| |------|---------| | ||
| | `-d, --dist-dir <dir>` | Output folder (default: `dist`) | | ||
| | `--no-build` | Deploy existing build output only | | ||
| | `-b, --branch <branch>` | Deploy branch (default: `gh-pages`) | | ||
| | `--base <path>` | Override public asset path (default: derived from repo name) | | ||
|
|
||
| Examples: | ||
|
|
||
| ```bash | ||
| # Deploy a project in another directory | ||
| pfcli deploy ./my-app | ||
|
|
||
| # CRA or webpack output in build/ | ||
| pfcli deploy -d build | ||
|
|
||
| # Skip build when dist/ is already built | ||
| pfcli deploy --no-build | ||
|
|
||
| # User/org site served from root (e.g. owner.github.io) | ||
| pfcli deploy --base / | ||
| ``` | ||
|
|
||
| For project repos (`github.com/owner/my-app`), `pfcli deploy` automatically sets Vite `--base`, webpack `ASSET_PATH`, or CRA `PUBLIC_URL` to `/<repo>/`. | ||
|
|
||
| If the app uses React Router, remind the user to set `basename` to match the public path (e.g. `<BrowserRouter basename="/my-app">`). | ||
|
|
||
| ### Step 3: Share the result | ||
|
|
||
| On success, the CLI prints the live URL: | ||
|
|
||
| - Project page: `https://<owner>.github.io/<repo>/` | ||
| - User/org page: `https://<owner>.github.io/` | ||
|
|
||
| Tell the user the URL may take a minute to update on first deploy. If Pages is not enabled, they can set **Settings → Pages → Source** to the `gh-pages` branch. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| | Error | Likely cause | Fix | | ||
| |-------|--------------|-----| | ||
| | `Please save your changes first...` | No `origin` remote | Run `pfcli init` or add `git remote add origin ...` | | ||
| | `No package.json found` | Wrong directory | `cd` to project root or pass the path | | ||
| | `No "build" script found` | Missing build script | Add `"build"` to `package.json` or use `--no-build -d <dir>` | | ||
| | `Build output directory "dist" does not exist` | Wrong output dir or failed build | Fix the build or pass `-d` with the correct folder | | ||
| | Blank page or missing assets | Wrong base path | Re-deploy; for custom hosting use `--base /<repo>/` | | ||
| | `gh auth` failures | GitHub CLI not authenticated | Run `gh auth login` | | ||
|
|
||
| Do not manually configure GitHub Actions or gh-pages npm scripts when `pfcli deploy` is available — the CLI handles build env vars, SPA `404.html`, and Pages setup. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Add
disable-model-invocation: trueto frontmatter.This skill executes
pfcli deploywhich deploys to GitHub Pages—a side-effecting operation. Per PatternFly coding guidelines and documented convention, SKILL.md frontmatter must includedisable-model-invocation: truefor any skill that performs deployments, writes files, creates issues, or posts external content. Omitting this flag creates a security risk by allowing unintended programmatic invocation of the deploy command.🔒 Proposed fix to add the disable-model-invocation flag
--- name: pf-github-pages-deploy description: Deploy a PatternFly React project to GitHub Pages using pfcli deploy. Use when publishing a prototype, sharing a demo URL, deploying to GitHub Pages, or when the user mentions pfcli deploy. +disable-model-invocation: true ---🤖 Prompt for AI Agents
Sources: Coding guidelines, Learnings