{"id":50986366,"url":"https://github.com/sultann/branch-deploy-action","last_synced_at":"2026-06-19T19:31:14.555Z","repository":{"id":323823564,"uuid":"1094845259","full_name":"sultann/branch-deploy-action","owner":"sultann","description":"Deploy filtered content to any branch with git history preservation. Supports .distignore, manual exclusions, and build scripts.","archived":false,"fork":false,"pushed_at":"2025-11-12T08:53:06.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-12T10:25:13.388Z","etag":null,"topics":["automation","branch-deployment","ci-cd","deployment","distignore","git-history","github-actions","wordpress"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sultann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-12T08:50:38.000Z","updated_at":"2025-11-12T08:53:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sultann/branch-deploy-action","commit_stats":null,"previous_names":["sultann/branch-deploy-action"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sultann/branch-deploy-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultann%2Fbranch-deploy-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultann%2Fbranch-deploy-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultann%2Fbranch-deploy-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultann%2Fbranch-deploy-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sultann","download_url":"https://codeload.github.com/sultann/branch-deploy-action/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultann%2Fbranch-deploy-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34546191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","branch-deployment","ci-cd","deployment","distignore","git-history","github-actions","wordpress"],"created_at":"2026-06-19T19:31:13.681Z","updated_at":"2026-06-19T19:31:14.548Z","avatar_url":"https://github.com/sultann.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Branch Deploy Action\n\nDeploy filtered content from one branch to another while preserving git history. Designed for creating distribution branches with build artifacts but without development files.\n\n## Features\n\n- Deploy from any branch to any branch with history preservation\n- Support for `.distignore`, `.deployignore`, or custom ignore files\n- Manual exclusions and inclusions (override patterns)\n- Optional build scripts (composer, npm, custom commands)\n- Automatic composer.json cleanup for distribution\n- Customizable commit messages with placeholders\n- Secure token management\n\n## Quick Start\n\n```yaml\nname: Deploy to Trunk\n\non:\n  push:\n    branches: [master]\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - uses: sultann/branch-deploy-action@v1\n        with:\n          target-branch: trunk\n```\n\n## Common Use Cases\n\n### WordPress Plugin Distribution\n\nDeploy to trunk without development files:\n\n```yaml\n- uses: sultann/branch-deploy-action@v1\n  with:\n    target-branch: trunk\n    ignore-file: .distignore\n    script-before: composer install --no-dev --optimize-autoloader\n```\n\nThe action automatically cleans `composer.json` by removing `.extra`, `.scripts`, `.config`, `.repositories`, `require-dev`, and `autoload-dev`.\n\nDisable composer cleanup if needed:\n\n```yaml\ncomposer-cleanup: false\n```\n\n### Keep Workflows in Trunk\n\nSometimes you want trunk to have `.github` for workflows, but your `.distignore` excludes it. Use `include-paths` to override:\n\n```yaml\n- uses: sultann/branch-deploy-action@v1\n  with:\n    target-branch: trunk\n    ignore-file: .distignore  # excludes .github\n    include-paths: .github    # but include it anyway\n```\n\n### NPM Package Distribution\n\n```yaml\n- uses: sultann/branch-deploy-action@v1\n  with:\n    target-branch: dist\n    ignore-file: .npmignore\n    script-before: |\n      npm ci\n      npm run build\n```\n\n## Configuration\n\n### Inputs\n\n| Input | Description | Required | Default |\n|-------|-------------|----------|---------|\n| `source-branch` | Branch to deploy from | No | Current branch |\n| `target-branch` | Branch to deploy to | Yes | - |\n| `ignore-file` | Path to ignore file | No | `.distignore` |\n| `include-paths` | Paths to include (overrides ignore-file) | No | - |\n| `script-before` | Commands to run before deployment | No | - |\n| `composer-cleanup` | Clean composer.json for distribution | No | `true` |\n| `commit-message` | Commit message template | No | `Deploy from {source-branch} ({commit-short-sha})` |\n| `github-token` | GitHub authentication token | No | Auto-detected |\n\n### Commit Message Templates\n\nCustomize commit messages with placeholders:\n\n- `{source-branch}` - Name of the source branch\n- `{commit-sha}` - Full commit hash\n- `{commit-short-sha}` - Abbreviated commit hash\n\nExample:\n```yaml\ncommit-message: \"Release from {source-branch} - {commit-short-sha}\"\n```\n\n### Ignore File Format\n\nStandard gitignore-style format with negation support:\n\n```\n# .distignore example\n.git\n.github\nnode_modules\ntests\n*.md\n!README.md\n```\n\n### How Exclusions Work\n\nThe action processes patterns in this order:\n\n1. Default exclusions (`.git/`, `node_modules/`, `deploy-temp/`)\n2. **Includes from `include-paths`** (processed FIRST so they override ignore-file)\n3. Patterns from `ignore-file`\n\n**Key point:** `include-paths` is processed before `ignore-file`, so you can override exclusions.\n\n## How It Works\n\n1. Validates inputs and runs build script (if provided)\n2. Cleans composer.json (if enabled)\n3. Builds exclusion list from ignore file + manual paths\n4. Copies filtered files to temporary directory using rsync\n5. Initializes git and syncs with remote target branch\n6. Uses `git reset --soft` to preserve history\n7. Commits changes and pushes to target branch\n\nThe action cleans up temporary files on exit, even on failure.\n\n## Troubleshooting\n\n**No changes detected**\n\nCheck your ignore file - it might exclude everything. Common issue: `.distignore` has `.*` which excludes all dotfiles.\n\n**Permission errors**\n\nEnsure your GitHub token has `contents: write` permission.\n\n**Push rejected**\n\nThe target branch may have protection rules. Check branch settings or use a different workflow trigger.\n\n## Security\n\nThe action uses git credential helper with cleanup on exit. Tokens never appear in logs or command output. All inputs are validated before execution.\n\n## Testing Locally\n\nTest the deployment script locally:\n\n```bash\nexport GITHUB_REPOSITORY=\"owner/repo\"\nexport GITHUB_TOKEN=\"your-token\"\nexport TARGET_BRANCH=\"test-branch\"\nexport IGNORE_FILE=\".distignore\"\n\nbash deploy.sh\n```\n\n## Publishing\n\nTo publish this action:\n\n1. Create repository at `github.com/sultann/branch-deploy-action`\n2. Copy files to repository root\n3. Tag a release: `git tag -a v1.0.0 -m \"Initial release\"`\n4. Push tags: `git push --tags`\n5. Create major version tag: `git tag -a v1 -m \"Version 1\" \u0026\u0026 git push origin v1`\n\nUsers can then reference it:\n```yaml\n- uses: sultann/branch-deploy-action@v1\n```\n\n## License\n\nMIT License\n\n## Author\n\nSultan Nasir Uddin ([sultann](https://github.com/sultann))","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsultann%2Fbranch-deploy-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsultann%2Fbranch-deploy-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsultann%2Fbranch-deploy-action/lists"}