{"id":26468738,"url":"https://github.com/batonogov/gitlab-auto-mr","last_synced_at":"2026-03-07T05:16:04.271Z","repository":{"id":299771129,"uuid":"999367883","full_name":"batonogov/gitlab-auto-mr","owner":"batonogov","description":"Create MR in GitLab automatically","archived":false,"fork":false,"pushed_at":"2026-02-28T12:14:50.000Z","size":127,"stargazers_count":0,"open_issues_count":17,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-28T16:38:11.724Z","etag":null,"topics":["auto-mr","docker","gitlab"],"latest_commit_sha":null,"homepage":"","language":"Go","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/batonogov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-06-10T06:35:56.000Z","updated_at":"2026-02-28T12:14:43.000Z","dependencies_parsed_at":"2025-08-18T07:16:17.137Z","dependency_job_id":"a8bc724f-ad91-4dc9-a63a-73164d919947","html_url":"https://github.com/batonogov/gitlab-auto-mr","commit_stats":null,"previous_names":["batonogov/gitlab-auto-mr"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/batonogov/gitlab-auto-mr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batonogov%2Fgitlab-auto-mr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batonogov%2Fgitlab-auto-mr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batonogov%2Fgitlab-auto-mr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batonogov%2Fgitlab-auto-mr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/batonogov","download_url":"https://codeload.github.com/batonogov/gitlab-auto-mr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batonogov%2Fgitlab-auto-mr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30208730,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T03:24:23.086Z","status":"ssl_error","status_checked_at":"2026-03-07T03:23:11.444Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["auto-mr","docker","gitlab"],"created_at":"2025-03-19T16:33:11.409Z","updated_at":"2026-03-07T05:16:03.674Z","avatar_url":"https://github.com/batonogov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitLab Auto MR - Go Version\n\nAutomatically create Merge Requests in GitLab using a lightweight Go binary.\n\n## Features\n\n- ✅ Zero external dependencies - uses only Go standard library\n- ✅ Small Docker image (~26MB with Alpine 3.22)\n- ✅ Fast execution (~10ms startup time)\n- ✅ Compatible with GitLab CI/CD\n- ✅ Cross-platform support (Linux, macOS, Windows)\n- ✅ Built with Go 1.25 for optimal performance\n- ✅ Safe MR management - explicit control over creating or updating MRs\n- ✅ Prevents accidental overwrites - requires `--update-mr` flag to update existing MRs\n\n## Docker Images\n\nDocker images are automatically built and published to GitHub Container Registry for each release.\n\n### Available Tags\n\n- `latest` - Latest stable release\n- `vX.Y.Z` - Specific version (e.g., `v1.6.0`)\n- `vX.Y` - Latest patch version of a minor release (e.g., `v1.6`)\n- `vX` - Latest minor and patch version of a major release (e.g., `v1`)\n\n### Pull the Image\n\n```bash\n# Latest release\ndocker pull ghcr.io/batonogov/gitlab-auto-mr:latest\n\n# Specific version\ndocker pull ghcr.io/batonogov/gitlab-auto-mr:v1.6.0\n```\n\n### Supported Platforms\n\n- `linux/amd64`\n- `linux/arm64`\n\n## Quick Start\n\n1. **Set required environment variables:**\n\n```bash\nexport GITLAB_PRIVATE_TOKEN=\"your-gitlab-token\"\nexport GITLAB_USER_ID=\"your-user-id\"\nexport CI_PROJECT_ID=\"12345\"\nexport CI_PROJECT_URL=\"https://gitlab.com/user/project\"\nexport CI_COMMIT_REF_NAME=\"feature/my-branch\"\n```\n\n2. **Run with Docker (recommended):**\n\n```bash\n# Creates new MR or informs if MR already exists\ndocker run --rm \\\n  -e GITLAB_PRIVATE_TOKEN \\\n  -e GITLAB_USER_ID \\\n  -e CI_PROJECT_ID \\\n  -e CI_PROJECT_URL \\\n  -e CI_COMMIT_REF_NAME \\\n  ghcr.io/batonogov/gitlab-auto-mr:latest \\\n  gitlab_auto_mr --target-branch main --commit-prefix \"Ready\"\n```\n\n3. **Or build and run locally:**\n\n```bash\ngit clone https://github.com/user/gitlab-auto-mr.git\ncd gitlab-auto-mr\ntask build\n# Creates new MR or informs if MR already exists\n./gitlab_auto_mr --target-branch main --commit-prefix \"Ready\"\n```\n\n## Usage\n\n### GitLab CI/CD\n\n#### Create MR (Default Behavior)\n\n```yaml\ncreate_mr:\n  stage: create-mr\n  image: ghcr.io/batonogov/gitlab-auto-mr:latest\n  script:\n    - |\n      # Creates new MR or informs if MR already exists\n      gitlab_auto_mr \\\n        --target-branch main \\\n        --commit-prefix \"Ready\" \\\n        --remove-branch \\\n        --squash-commits\n  rules:\n    - if: $CI_COMMIT_BRANCH != \"main\" \u0026\u0026 $CI_PIPELINE_SOURCE != \"merge_request_event\"\n```\n\n#### Update Existing MR\n\n```yaml\nupdate_mr:\n  stage: update-mr\n  image: ghcr.io/batonogov/gitlab-auto-mr:latest\n  script:\n    - |\n      # Updates existing MR (requires --update-mr flag)\n      gitlab_auto_mr \\\n        --update-mr \\\n        --target-branch main \\\n        --commit-prefix \"Ready\" \\\n        --description .gitlab/merge_request_template.md \\\n        --use-issue-name \\\n        --reviewer-id \"${REVIEWER_IDS}\"\n  rules:\n    - if: $CI_COMMIT_BRANCH != \"main\" \u0026\u0026 $CI_PIPELINE_SOURCE != \"merge_request_event\"\n```\n\n#### Advanced Control\n\n```yaml\n# Force update only (fail if MR doesn't exist)\nupdate_only:\n  script:\n    - gitlab_auto_mr --update-mr --target-branch main\n\n# Force create only (fail if MR already exists)\ncreate_only:\n  script:\n    - gitlab_auto_mr --create-only --target-branch main\n```\n\n### Required Environment Variables\n\n- `GITLAB_PRIVATE_TOKEN` - GitLab personal access token with `api` scope\n- `GITLAB_USER_ID` - Your GitLab user ID (comma-separated for multiple assignees)\n- `CI_PROJECT_ID` - GitLab project ID\n- `CI_PROJECT_URL` - GitLab URL\n- `CI_COMMIT_REF_NAME` - Source branch name\n\n### CLI Options\n\n| Option                  | Short | Description                                    | Default                |\n| ----------------------- | ----- | ---------------------------------------------- | ---------------------- |\n| `--target-branch`       | `-t`  | Target branch for MR                           | Project default branch |\n| `--commit-prefix`       | `-c`  | MR title prefix                                | `Draft`                |\n| `--title`               |       | Custom MR title                                | Source branch name     |\n| `--description`         | `-d`  | Path to description file                       | -                      |\n| `--remove-branch`       | `-r`  | Delete source branch after merge               | `false`                |\n| `--squash-commits`      | `-s`  | Squash commits on merge                        | `false`                |\n| `--use-issue-name`      | `-i`  | Use issue data from branch name                | `false`                |\n| `--allow-collaboration` | `-a`  | Allow commits from merge target members        | `false`                |\n| `--reviewer-id`         |       | Reviewer user ID(s) (comma-separated)          | -                      |\n| `--mr-exists`           |       | Only check if MR exists (dry run)              | `false`                |\n| `--update-mr`           |       | Update existing MR (required to update, fail if none exists) | `false`                |\n| `--create-only`         |       | Force create new MR (fail if already exists)   | `false`                |\n| `--insecure`            | `-k`  | Skip SSL certificate verification              | `false`                |\n\n## Building\n\n### Prerequisites\n\n- Go 1.25 or later\n- Task (optional, for build automation)\n\n### Local Development\n\n```bash\n# Using Task (recommended)\ntask build      # Build binary\ntask test       # Run tests\ntask docker-build  # Build Docker image\ntask clean      # Clean artifacts\ntask --list     # Show all tasks\n\n# Or using Go directly\ngo build -o gitlab_auto_mr .\ngo test ./...\n```\n\n### Pre-commit Hooks\n\nThis project uses pre-commit hooks for code quality and consistency:\n\n```bash\n# Install pre-commit (if not already installed)\npip install pre-commit\n\n# Install hooks\npre-commit install\n\n# Run hooks on all files\npre-commit run --all-files\n\n# Run hooks on specific files\npre-commit run --files main.go\n```\n\n**Included hooks:**\n\n- Go dependency verification\n- Go code formatting\n- Go linting\n- Go tests\n- Taskfile validation\n- Dockerfile validation\n- YAML validation\n- Markdown formatting\n- Large file detection\n- Merge conflict detection\n\n### Docker Build\n\n```bash\ntask docker-build\n# or\ndocker build -t gitlab-auto-mr .\n```\n\n## Examples\n\n### Create New MR (Default)\n\n```bash\n# Creates new MR or informs if MR already exists\n./gitlab_auto_mr \\\n  --target-branch main \\\n  --commit-prefix \"Ready\"\n```\n\n### With Reviewers\n\n```bash\n./gitlab_auto_mr \\\n  --target-branch main \\\n  --reviewer-id \"12345,67890\"\n```\n\n### Check if MR Exists\n\n```bash\n./gitlab_auto_mr \\\n  --mr-exists \\\n  --target-branch main\n```\n\n### Update Existing MR\n\n```bash\n# Update existing MR (requires --update-mr flag, fail if MR doesn't exist)\n./gitlab_auto_mr \\\n  --update-mr \\\n  --target-branch main \\\n  --title \"Updated Title\" \\\n  --description new_description.md\n```\n\n### Force Create Only\n\n```bash\n# Only create new MR (fail if MR already exists)\n./gitlab_auto_mr \\\n  --create-only \\\n  --target-branch main \\\n  --reviewer-id \"12345,67890\"\n```\n\n## Troubleshooting\n\n**Authentication Error**\n\n```\nError: unable to get project 12345: unauthorized access, check your access token is valid\n```\n\n- Check your `GITLAB_PRIVATE_TOKEN` is valid and has `api` scope\n\n**MR Already Exists**\n\n```\nMerge request already exists: Feature XYZ (IID: 42). Use --update-mr flag to update it.\n```\n\n- This is the default behavior when MR already exists\n- Add `--update-mr` flag to update the existing MR instead\n\n**Update Mode Error**\n\n```\nError: merge request does not exist for this branch feature/test to main, cannot update non-existent MR\n```\n\n- This happens when using `--update-mr` flag but no MR exists\n- Remove `--update-mr` flag to create a new MR instead\n\n**Force Create Mode Error**\n\n```\nError: merge request already exists for this branch feature/test to main, cannot create new MR in create-only mode\n```\n\n- This happens when using `--create-only` flag but MR already exists\n- Remove `--create-only` flag to allow the tool to inform about existing MR\n- Use `--update-mr` flag instead if you want to update the existing MR\n\n**Same Source/Target Branch**\n\n```\nError: source branch and target branches must be different\n```\n\n- Ensure you're not running on the target branch\n\n## Performance vs Python Version\n\n| Metric       | Go Version | Python Version |\n| ------------ | ---------- | -------------- |\n| Binary Size  | ~5.7MB     | ~50MB+         |\n| Docker Image | ~26MB      | ~80MB+         |\n| Startup Time | ~10ms      | ~200ms+        |\n| Memory Usage | ~5MB       | ~20MB+         |\n| Dependencies | 0 external | 10+ packages   |\n\n## License\n\nMIT License - see LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatonogov%2Fgitlab-auto-mr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbatonogov%2Fgitlab-auto-mr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatonogov%2Fgitlab-auto-mr/lists"}