@@ -21,6 +21,8 @@ A Laravel package for syncing with upstream repositories (GitHub, GitLab, Bitbuc
2121- 🚀 ** Production ready** - Timeout protection and proper error handling
2222- 🎯 ** Starter Kit Support** - Pre-configured for all official Laravel starter kits
2323- 🔧 ** Easy Setup** - Interactive setup command for quick configuration
24+ - 🔀 ** Pull Request Workflow** - Create PRs instead of direct merges for safer updates
25+ - 🤖 ** GitHub Integration** - Automatic PR creation with GitHub API
2426
2527## Installation
2628
@@ -99,47 +101,81 @@ UPSTREAM_COMMIT_MESSAGE="chore(upstream): sync from upstream"
99101UPSTREAM_ALLOW_UNRELATED=true
100102UPSTREAM_DEFAULT_PRESET=vue
101103UPSTREAM_AUTO_DETECT=true
104+ UPSTREAM_CREATE_PR=false
105+ UPSTREAM_PR_BRANCH_PREFIX=upstream-sync-
106+ UPSTREAM_PR_TITLE="chore: sync from upstream"
107+ UPSTREAM_PR_BODY="Automated upstream sync from {upstream_url}"
108+ GITHUB_TOKEN=your_github_token
109+ GITHUB_OWNER=your_username
110+ GITHUB_REPO=your_repo
102111GIT_BINARY=git
103112```
104113
105114## Usage
106115
116+ ### Recommended Workflow
117+
118+ The recommended workflow is to check for updates first, then upgrade:
119+
120+ ``` bash
121+ # 1. Check if updates are available
122+ php artisan upstream:check
123+
124+ # 2. If updates are available, upgrade your project
125+ php artisan upstream:upgrade
126+
127+ # 3. Or create a pull request for safer updates
128+ php artisan upstream:upgrade --pr
129+ ```
130+
107131### Quick Start Examples
108132
109133#### Vue Starter Kit
110134``` bash
111135# Setup for Vue starter kit
112136php artisan upstream:setup --preset=vue
113137
114- # Test and sync
115- php artisan upstream:sync --test
138+ # Check for updates
139+ php artisan upstream:check
140+
141+ # Upgrade with updates
142+ php artisan upstream:upgrade
116143```
117144
118145#### React Starter Kit
119146``` bash
120147# Setup for React starter kit
121148php artisan upstream:setup --preset=react
122149
123- # Test and sync
124- php artisan upstream:sync --test
150+ # Check for updates
151+ php artisan upstream:check
152+
153+ # Upgrade with updates
154+ php artisan upstream:upgrade
125155```
126156
127157#### Livewire Starter Kit
128158``` bash
129159# Setup for Livewire starter kit
130160php artisan upstream:setup --preset=livewire
131161
132- # Test and sync
133- php artisan upstream:sync --test
162+ # Check for updates
163+ php artisan upstream:check
164+
165+ # Upgrade with updates
166+ php artisan upstream:upgrade
134167```
135168
136169#### Custom Repository
137170``` bash
138171# Setup for custom repository
139172php artisan upstream:setup --preset=custom --url=https://github.com/your-org/your-repo.git
140173
141- # Test and sync
142- php artisan upstream:sync --test
174+ # Check for updates
175+ php artisan upstream:check
176+
177+ # Upgrade with updates
178+ php artisan upstream:upgrade
143179```
144180
145181### Using Default Presets
@@ -160,10 +196,58 @@ UPSTREAM_DEFAULT_PRESET=livewire
160196With a default preset configured, you can simply run:
161197
162198``` bash
163- # Uses the default preset automatically
164- php artisan upstream:sync --test
199+ # Check for updates (uses default preset automatically)
200+ php artisan upstream:check
201+
202+ # Upgrade if updates are available
203+ php artisan upstream:upgrade
165204```
166205
206+ ## Pull Request Workflow
207+
208+ For safer updates in production environments, you can create pull requests instead of direct merges:
209+
210+ ### Setup GitHub Integration
211+
212+ 1 . ** Create a GitHub Personal Access Token:**
213+ - Go to GitHub Settings → Developer settings → Personal access tokens
214+ - Generate a new token with ` repo ` permissions
215+ - Add it to your ` .env ` file
216+
217+ 2 . ** Configure GitHub settings:**
218+ ``` env
219+ GITHUB_TOKEN=ghp_your_token_here
220+ GITHUB_OWNER=your_username
221+ GITHUB_REPO=your_repo_name
222+ ```
223+
224+ ### Create Pull Requests
225+
226+ ``` bash
227+ # Check for updates first
228+ php artisan upstream:check
229+
230+ # Create a PR with upstream updates
231+ php artisan upstream:upgrade --pr
232+
233+ # Or use the direct PR command
234+ php artisan upstream:pr --test
235+
236+ # Create PR with custom branch name
237+ php artisan upstream:pr --pr-branch=update-vue-starter-kit
238+
239+ # Create PR with custom title and body
240+ php artisan upstream:pr --pr-title=" Update from Vue starter kit" --pr-body=" Sync latest changes from upstream"
241+ ```
242+
243+ ### PR Workflow Benefits
244+
245+ - ** 🔒 Safer Updates** - Review changes before merging
246+ - ** 📝 Better Documentation** - PR descriptions and commit history
247+ - ** 👥 Team Collaboration** - Multiple reviewers can approve
248+ - ** 🔄 Easy Rollback** - Simple to revert if issues arise
249+ - ** 📊 Change Tracking** - Clear history of what changed and when
250+
167251### Advanced Usage
168252
169253#### Basic Sync
@@ -290,6 +374,26 @@ For CI/CD environments, use personal access tokens in your repository URL:
290374https://username:token@github.com/user/repo.git
291375```
292376
377+ ## Available Commands
378+
379+ ### ` upstream:check `
380+ Check if there are updates available from upstream repository.
381+
382+ ### ` upstream:upgrade `
383+ Upgrade your project with the latest changes from upstream (recommended).
384+
385+ ### ` upstream:upgrade --pr `
386+ Create a pull request with upstream updates (safer for production).
387+
388+ ### ` upstream:sync `
389+ Direct sync with upstream repository (merges directly to your branch).
390+
391+ ### ` upstream:pr `
392+ Create a pull request with upstream updates (alternative to upgrade --pr).
393+
394+ ### ` upstream:setup `
395+ Interactive setup wizard for configuring the package.
396+
293397## Command Options
294398
295399| Option | Description |
@@ -303,6 +407,9 @@ https://username:token@github.com/user/repo.git
303407| ` --branch= ` | Override upstream branch |
304408| ` --local= ` | Override local branch |
305409| ` --remote-name= ` | Remote name to use (default: upstream) |
410+ | ` --pr-branch= ` | Override PR branch name (upstream: pr only) |
411+ | ` --pr-title= ` | Override PR title (upstream: pr only) |
412+ | ` --pr-body= ` | Override PR body (upstream: pr only) |
306413
307414## Requirements
308415
0 commit comments