mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-11 18:28:15 +00:00
73 lines
2.5 KiB
Markdown
73 lines
2.5 KiB
Markdown
# Component sync workflow
|
|
|
|
This workflow synchronizes components from the main [untitleduico/react](https://github.com/untitleduico/react) repository with intelligent commit tracking.
|
|
|
|
## How to use
|
|
|
|
1. Go to the "Actions" tab in your GitHub repository
|
|
2. Select "Sync Components from Main Repository"
|
|
3. Click "Run workflow"
|
|
4. Configure options:
|
|
- **Directories**: Which directories to sync (default: `components,hooks,utils,styles`)
|
|
- **Sync mode**: Choose between `all` or `existing-only`
|
|
5. Click "Run workflow" to start the sync
|
|
|
|
## What it does
|
|
|
|
1. **Fetches** the latest commit information from the main repository
|
|
2. **Tracks** previously synced commits to show what's new
|
|
3. **Creates** a branch named `sync/YYYY-MM-DD-[commit-hash]`
|
|
4. **Processes** files by removing `"use client";` directives
|
|
5. **Generates** a PR with commit history and detailed diff summaries
|
|
6. **Stores** the sync state for future runs
|
|
|
|
## Sync modes
|
|
|
|
### `all` (default)
|
|
- Syncs all files from the main repository
|
|
- Adds new files and updates existing ones
|
|
- Creates complete mirror of main repo structure
|
|
|
|
### `existing-only`
|
|
- Only updates files that already exist in your repository
|
|
- Skips new files from the main repository
|
|
- Useful for maintaining a subset of components
|
|
|
|
## Smart commit tracking
|
|
|
|
- **First run**: Shows "Initial sync" with latest commit details
|
|
- **Subsequent runs**: Shows commit range since last sync
|
|
- **Up-to-date**: Indicates when no new commits are available
|
|
- **Commit history**: Collapsible list of all commits since last sync
|
|
|
|
## Branch naming
|
|
|
|
Branches follow the pattern: `sync/YYYY-MM-DD-[short-commit-hash]`
|
|
- Example: `sync/2024-03-15-a1b2c3d`
|
|
|
|
## PR format
|
|
|
|
The generated PR includes:
|
|
|
|
### Title
|
|
- **New commits**: `🔄 Sync components (X commits) → a1b2c3d`
|
|
- **First sync**: `🎉 Initial sync from main repository → a1b2c3d`
|
|
|
|
### Content
|
|
- **Commits since last sync**: Collapsible commit history with links
|
|
- **Changed files**: Each file with collapsible diff view
|
|
- **Sync details**: Source repo, latest commit, date, directories synced
|
|
- **Automated processing**: Notes about `"use client"` removal
|
|
|
|
## State management
|
|
|
|
The workflow stores sync state in `.github/last-sync-commit` to track:
|
|
- Last successfully synced commit hash
|
|
- Enables incremental sync reporting
|
|
- Shows commit ranges in PR descriptions
|
|
|
|
## Requirements
|
|
|
|
- Repository must have `contents: write` and `pull-requests: write` permissions
|
|
- Uses `GITHUB_TOKEN` (automatically available in GitHub Actions)
|
|
- GitHub CLI (`gh`) for PR creation |