Package: gerrit-to-platform
gerrit-to-platformGerrittoGitHub/GitLab(not yet available)Gerrit hooks to allow using GitHub and GitLab as CI platforms.To use, install the Gerrithooksplugin and then symlink the hooks from the
virtualenv that has the package installed.A Python 3.8 or greater environmentRepositories that use the CI platform must have full mirroring replication
configured. In specificrefs/*must be in the replication set and notrefs/heads/*To activate a given hook, symlink the installed hook in the gerrit hooks
directory.Two configuration files needed. These files are:~gerrituser/.config/gerrit_to_platform/gerrit_to_platform.ini~gerrituser/.config/gerrit_to_platform/replication.configThe replication.config file should be a symlink to the standard Gerrit
replication.config fileThegerrit_to_platform.inifile has the following format:[mapping "content-added"]
recheck = verify
remerge = merge

[github.com]
token = <a_token_that_allows_triggering_actions>

[gitlab.com]
token = <a_token_that_allows_triggering_workflows>Thecontent-addedmapping section is a key value pair for comment triggers
to the corresponding workflow name or filenameGitHub Workflow ConfigurationThere are three hooks that gerrit-to-platform handles:patchset-created (search filter: verify)change-merged (search filter: merge)comment-added (comment mapping for keyword to search filter)Configuration for triggered workflows must meet the following requirements:The workflow filename must contain ‘gerrit’The workflow filename must contain the search filterRequired workflows must be part of the ORGANIZATION/.github magic repository.
These workflow filenames must also contain ‘required’ex:.github/workflows/gerrit-verify.yamlor.github/workflows/gerrit-required-verify.yamlStandard workflows (non-required ones) must have the following primary configuration:---
name: Gerrit Verify

# yamllint disable-line rule:truthy
on:
  workflow_dispatch:
    inputs:
      GERRIT_BRANCH:
        description: 'Branch that change is against'
        required: true
        type: string
      GERRIT_CHANGE_ID:
        description: 'The ID for the change'
        required: true
        type: string
      GERRIT_CHANGE_NUMBER:
        description: 'The Gerrit number'
        required: true
        type: string
      GERRIT_CHANGE_URL:
        description: 'URL to the change'
        required: true
        type: string
      GERRIT_EVENT_TYPE:
        description: 'Gerrit event type'
        required: true
        type: string
      GERRIT_PATCHSET_NUMBER:
        description: 'The patch number for the change'
        required: true
        type: string
      GERRIT_PATCHSET_REVISION:
        description: 'The revision sha'
        required: true
        type: string
      GERRIT_PROJECT:
        description: 'Project in Gerrit'
        required: true
        type: string
      GERRIT_REFSPEC:
        description: 'Gerrit refspec of change'
        required: true
        type: string


concurrency:
  group: ${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
  cancel-in-progress: true

jobs:
  <your_job_configurations>Required workflows must have the following extra input:TARGET_REPO:
  description: 'The target GitHub repository needing the required workflow'
  required: true
  type: stringMaking Changes & ContributingThis project usespre-commit, please make sure to install it before making any
changes:pip install pre-commit
cd gerrit_to_platform
pre-commit install
pre-commit install -t commit-msgDon’t forget to tell your contributors to also install and use pre-commit.NotePyScaffold 4.4 provided the initial project setup. For details and usage
information on PyScaffold seehttps://pyscaffold.org/.