npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@opensaucedhub/git-sync-action

v1.1.4

Published

Synchronize GitHub repository with GitLab including branches, PRs, and issues

Downloads

376

Readme

GitHub GitLab Sync Action

A powerful GitHub Action that provides bi-directional synchronization between GitHub and GitLab repositories. This action helps maintain consistency across platforms by syncing branches, pull requests, issues, releases, and tags.

Features

  • 🔄 Bi-directional Synchronization: Sync from GitHub to GitLab and vice versa
  • 🌳 Branch Synchronization: Keep branches in sync across platforms
  • 🔀 Pull Request/Merge Request Sync: Synchronize pull requests with corresponding merge requests
  • 📝 Issue Tracking: Keep issues and their comments in sync
  • 🏷️ Release Management: Sync releases and tags across platforms
  • ⚙️ Configurable: Extensive configuration options for fine-grained control
  • 🔒 Protected Resources: Support for protected branches and resources
  • 🏷️ Label Management: Automatic labeling of synced resources

Setup

  1. Create a .github/workflows/sync.yml file in your repository:
name: Sync to GitLab
on:
  push:
    branches: [main]
  pull_request:
    types: [opened, closed, reopened]
  issues:
    types: [opened, closed, reopened]
  release:
    types: [published]
  schedule:
    - cron: '0 */6 * * *'
  workflow_dispatch:

jobs:
  sync:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
      issues: write

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Sync with GitLab
        uses: OpenSaucedHub/[email protected]
        with:
          CONFIG_PATH: .github/sync-config.yml # optional, defaults to .github/sync-config.yml
          GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} # optional, unless you want to sync to GitLab
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} # Optional, defaults to GITHUB_TOKEN
  1. Create a .github/sync-config.yml file with your sync configuration:
#sync-config.yml
# When you have gitlab.sync.[entity].enabled: true, it means those entities will be synced FROM GitHub TO GitLab
gitlab:
  enabled: true
  username: # Optional, defaults to GitHub repo owner

# When you have github.sync.[entity].enabled: true, it means those entities will be synced FROM GitLab TO GitHub
github:
  enabled: true

[!WARNING]

  • If no config is provided, everything defaults to true, autoMerge is false, Labels are set as specified in the default config and repo name and username default to GitHub repository owner/repo. See Accepted Configuration
  • In case of a partial config (missing fields), the defaults are used. (you MUST strictly set elements to false if you don't want them to sync). See Accepted Configuration
  1. Set up required secrets in your GitHub repository:
  • GITLAB_TOKEN: A GitLab personal access token with API access
  • GH_TOKEN: A GitHub personal access token (optional, defaults to GITHUB_TOKEN)

Accepted Configuration

#sync-config.yml
# When you have gitlab.sync.[entity].enabled: true, it means those entities will be synced FROM GitHub TO GitLab
gitlab:
  enabled: true
  url: 'gitlab.com' # Optional, defaults to gitlab.com
  username: # Optional, defaults to GitHub repo owner
  repo: # Optional, defaults to GitHub repo name
  sync:
    branches:
      enabled: true
      protected: true
      pattern: '*'

    pullRequests:
      enabled: true
      autoMerge: false
      labels: ['synced-from-github']

    issues:
      enabled: true
      syncComments: true
      labels: ['synced-from-github']

    releases:
      enabled: true

    tags:
      enabled: true # automatically enabled if releases = true

# When you have github.sync.[entity].enabled: true, it means those entities will be synced FROM GitLab TO GitHub
github:
  enabled: true
  username: # Optional, defaults to GitHub username
  repo: # Optional, defaults to GitHub repo name
  sync:
    branches:
      enabled: true
      protected: true
      pattern: '*'

    pullRequests:
      enabled: true
      autoMerge: false
      labels: ['synced-from-gitlab']

    issues:
      enabled: true
      syncComments: true
      labels: ['synced-from-gitlab']

    releases:
      enabled: true

    tags:
      enabled: true # automatically enabled if releases = true

Configuration Options

GitLab Configuration (gitlab)

| Option | Description | Required | Default | | ---------- | ----------------------------- | -------- | ----------------- | | enabled | Enable GitLab synchronization | No | true | | url | GitLab instance URL | No | gitlab.com | | username | GitLab username | No | GitHub repo owner | | repo | GitLab repository name | No | GitHub repo name |

GitHub Configuration (github)

| Option | Description | Required | Default | | ---------- | ----------------------------- | -------- | -------------- | | enabled | Enable GitHub synchronization | No | true | | username | GitHub username | No | GitHub context | | repo | GitHub repository name | No | GitHub context |

Sync Configuration

Branches

| Option | Description | Required | Default | | ----------- | ----------------------- | -------- | ------- | | enabled | Enable branch sync | No | true | | protected | Sync protected branches | No | true | | pattern | Branch name pattern | No | "*" |

Pull Requests

| Option | Description | Required | Default | | ----------- | --------------------------- | -------- | ------------------------- | | enabled | Enable PR sync | No | true | | autoMerge | Auto-merge synced PRs | No | false | | labels | Labels to add to synced PRs | No | synced-from-github/gitlab |

Issues

| Option | Description | Required | Default | | -------------- | ------------------------------ | -------- | ------------------------- | | enabled | Enable issue sync | No | true | | syncComments | Sync issue comments | No | false | | labels | Labels to add to synced issues | No | synced-from-github/gitlab |

Releases and Tags

| Option | Description | Required | Default | | --------- | ----------------------- | -------- | ------- | | enabled | Enable release/tag sync | No | true |

Token Permissions

GitLab Token

The GitLab token needs the following permissions:

  • api - Full API access
  • read_repository - Read repository
  • write_repository - Write repository

GitHub Token

The GitHub token needs the following permissions:

  • repo - Full repository access
  • workflow - Workflow access

Contributing 🤝

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

License 📄

This project is licensed under the MIT License - see the LICENSE file for details.

Security 🔐

  • The action uses token-based authentication for secure operations
  • Tokens are never exposed in logs or outputs
  • Protected branch settings are respected
  • All API calls use HTTPS

Support 💬

For support, please:

  1. Check the Issues page
  2. Create a new issue if your problem isn't already listed
  3. Provide as much context as possible

Acknowledgments 🙏