{"id":14963132,"url":"https://github.com/espressif/sync-pr-to-gitlab","last_synced_at":"2025-08-24T13:42:43.193Z","repository":{"id":223250995,"uuid":"759715503","full_name":"espressif/sync-pr-to-gitlab","owner":"espressif","description":"GitHub Action - Sync approved PRs to internal codebase (Gitlab)","archived":false,"fork":false,"pushed_at":"2025-07-31T06:25:36.000Z","size":125,"stargazers_count":2,"open_issues_count":5,"forks_count":4,"subscribers_count":8,"default_branch":"v1","last_synced_at":"2025-08-18T00:59:27.736Z","etag":null,"topics":["ci","espressif","github-actions"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/espressif.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2024-02-19T07:44:25.000Z","updated_at":"2025-07-31T06:26:29.000Z","dependencies_parsed_at":"2024-03-27T07:30:03.053Z","dependency_job_id":"2f55ccbd-fb6f-4e96-8f8b-3f15593a7908","html_url":"https://github.com/espressif/sync-pr-to-gitlab","commit_stats":null,"previous_names":["espressif/sync-pr-to-gitlab"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/espressif/sync-pr-to-gitlab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fsync-pr-to-gitlab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fsync-pr-to-gitlab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fsync-pr-to-gitlab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fsync-pr-to-gitlab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/espressif","download_url":"https://codeload.github.com/espressif/sync-pr-to-gitlab/tar.gz/refs/heads/v1","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fsync-pr-to-gitlab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271877144,"owners_count":24837505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"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":["ci","espressif","github-actions"],"created_at":"2024-09-24T13:31:03.947Z","updated_at":"2025-08-24T13:42:43.143Z","avatar_url":"https://github.com/espressif.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eGitHub PR to Gitlab MR Sync (GitHub Action)\u003c/h1\u003e\n  \u003cimg src=\"docs/sync-to-gitlab.png\" alt=\"GitHub PR to Gitlab MR Sync logo\" width=\"400\"\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003c!-- GitHub Badges --\u003e\n   \u003cimg alt=\"release\" src=\"https://img.shields.io/github/v/release/espressif/sync-pr-to-gitlab\" /\u003e\n   \u003cimg alt=\"codeql\" src=\"https://github.com/espressif/sync-pr-to-gitlab/actions/workflows/github-code-scanning/codeql/badge.svg?branch=v1\" /\u003e\n\u003c/div\u003e\nGitHub PR to Gitlab MR Sync Action is a solution for one-way synchronization of GitHub PRs into Espressif Gitlab MRs.\n\u003cbr\u003e\n\u003cbr\u003e\nThis script automates the process of creating branches and PRs on the internal codebase of Espressif based on approved PRs on Github.\n\n\u003chr\u003e\n\n- [Workflow Overview](#workflow-overview)\n  - [Workflow File](#workflow-file)\n  - [Environment Variables and Secrets Configuration](#environment-variables-and-secrets-configuration)\n- [Steps to Sync a PR (by user)](#steps-to-sync-a-pr-by-user)\n- [Project Issues](#project-issues)\n- [Contributing](#contributing)\n\n## Workflow Overview\n\nThis document outlines the steps required to synchronize pull requests (PRs) using a specific GitHub Action. The process ensures the most recent changes are safely merged, rebased, or updated in your project repository.\n\nTo use this GitHub Action in your repository, you need to create the following:\n\n- A workflow file\n- Issue/PR labels: `PR-Sync-Merge`, `PR-Sync-Rebase`, `PR-Sync-Update`\n- Action secrets\n\n### Workflow File\n\nBelow is an example of the workflow file:\n\n```yaml\n# FILE: .github/workflows/pr_approved.yml\n\nname: Sync approved PRs to internal codebase\non:\n  pull_request_target:\n    types: [labeled]\n\njobs:\n  sync_prs_to_internal_codebase:\n    name: GitHub PR to Internal Codebase Sync\n    runs-on: ubuntu-latest\n    if: (github.event.label.name == 'PR-Sync-Merge')   ||\n        (github.event.label.name == 'PR-Sync-Rebase')  ||\n        (github.event.label.name == 'PR-Sync-Update')\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Sync approved PRs to internal codebase\n        uses: espressif/sync-pr-to-gitlab@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          GITLAB_URL: ${{ secrets.GITLAB_URL }}\n          GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}\n          GIT_CONFIG_NAME: ${{ secrets.GIT_CONFIG_NAME }}\n          GIT_CONFIG_EMAIL: ${{ secrets.GIT_CONFIG_EMAIL }}\n          JIRA_PROJECT: SOMEPROJECT\n          GITLAB_NAMESPACE: SOMENAMESPACE  # This is optional (defaults to 'espressif' if not present)\n```\n\n### Environment Variables and Secrets Configuration\n\nThe GitHub PR to GitLab MR Sync workflow requires configuring specific environment variables and secrets to operate effectively.\n\nBelow is a detailed table outlining the necessary configurations:\n\n| Variable/Secret    | Description                                                                | Requirement |\n| ------------------ | -------------------------------------------------------------------------- | ----------- |\n| `GITHUB_TOKEN`     | Automatically provided by GitHub to authorize actions.                     | Inherited   |\n| `GITLAB_URL`       | URL of the Espressif GitLab instance for API requests.                     | Mandatory   |\n| `GITLAB_TOKEN`     | Access token for creating MRs, comments, and updates in Espressif GitLab.  | Mandatory   |\n| `GIT_CONFIG_NAME`  | Username for Git commits when syncing, usually a bot name.                 | Mandatory   |\n| `GIT_CONFIG_EMAIL` | Email for Git commits when syncing, representing the bot email.            | Mandatory   |\n| `JIRA_PROJECT`     | The slug of the JIRA project where new issues will be created.             | Mandatory   |\n| `GITLAB_NAMESPACE` | Namespace in GitLab where the project is located. Defaults to 'espressif'. | Optional    |\n\n## Steps to Sync a PR (by user)\n\n1. **Initiate Sync**: Once a PR is reviewed and ready to merge, add a comment in the PR's discussion with the format `sha=1a2b3c4`. This comment should include the SHA1 hash (either long or short form) of the **most recent** commit you wish to merge or update. The `sha` acts as a marker for the action to identify the specific commit.\n\n2. **Label the PR**: Apply one of the following labels to the PR to trigger the syncing action:\n   - `PR-Sync-Merge`: Merges the PR by creating an internal PR from the GitHub PR branch head to the internal remote, aligning closely with the current default (`master`) branch. This method is preferred for new PRs.\n   - `PR-Sync-Rebase`: For older PRs, this label rebases the GitHub PR onto the latest internal master branch.\n   - `PR-Sync-Update`: Updates an internal PR with any new commits or changes on the PR's fork branch. To re-trigger the update workflow after its initial run, remove and then reapply the `PR-Sync-Update` label.\n\n\u003e **Note**: Only contributors with access levels higher than [TRIAGE](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization) can apply these labels on GitHub.\n\n---\n\n## Project Issues\n\nIf you encounter any issues, feel free to report them in the project's issues or create Pull Request with your suggestion.\n\n## Contributing\n\n📘 If you are interested in contributing to this project, see the [project Contributing Guide](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespressif%2Fsync-pr-to-gitlab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fespressif%2Fsync-pr-to-gitlab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespressif%2Fsync-pr-to-gitlab/lists"}