Create Gerrit Review

Action ID: publish:gerrit:review
NPM Package:

@backstage/plugin-scaffolder-backend-module-gerrit

Description

Creates a new Gerrit review.

Input Schema

PropertyTypeDescriptionRequired
branchstringBranch of the repository the review will be created on
repoUrlstringRepository Location
signCommitbooleanSign commit with configured PGP private key
sourcePathstringSubdirectory of working directory containing the repository
gitAuthorNamestring-
gitAuthorEmailstring-
gitCommitMessagestring-

Output Schema

PropertyTypeDescriptionRequired
reviewUrlstringA URL to the review
repoContentsUrlstringA URL to the root of the repository

Usage Examples

Create a review on main with template-generated files

Generates files with fetch:template and opens a Gerrit review on the main branch. Use this when scaffolding a new service and proposing it via a review.

Copy
steps:
  - id: fetchBase
    action: fetch:template
    name: Fetch template
    input:
      url: ./skeletons/service
      targetPath: .
      values:
        componentId: ${{ parameters.componentId }}
        owner: ${{ parameters.owner }}

  - id: createReview
    action: publish:gerrit:review
    name: Create Gerrit review
    input:
      repoUrl: gerrit.acme.corp?project=platform/payments-api
      branch: main
      gitCommitMessage: "chore: scaffold payments-api service from template"

  - id: logReview
    action: debug:log
    name: Log review URL
    input:
      message: "Gerrit review created at: ${{ steps.createReview.output.reviewUrl }}"

Create a review from a monorepo subdirectory

Uses fetch:template to place files under a monorepo folder and creates a review only from that subdirectory using sourcePath. Use this for monorepos where each service lives in its own folder.

Copy
steps:
  - id: fetchService
    action: fetch:template
    name: Fetch service template
    input:
      url: ./templates/node-service
      targetPath: services/${{ parameters.serviceName }}
      values:
        serviceName: ${{ parameters.serviceName }}
        owner: ${{ parameters.owner }}

  - id: reviewMonorepo
    action: publish:gerrit:review
    name: Create Gerrit review from subdirectory
    input:
      repoUrl: gerrit.acme.corp?project=platform/monorepo
      branch: develop
      sourcePath: services/${{ parameters.serviceName }}
      gitCommitMessage: "feat(${{ parameters.serviceName }}): add initial service skeleton"
      gitAuthorName: "Scaffolder Bot"
      gitAuthorEmail: "[email protected]"

  - id: logMonorepoReview
    action: debug:log
    name: Log review URL
    input:
      message: "Review: ${{ steps.reviewMonorepo.output.reviewUrl }}"

Create a signed commit review with custom author details

Creates a review with a signed commit for compliance. Use this when your project requires GPG-signed commits and explicit author metadata.

Copy
steps:
  - id: fetchPolicy
    action: fetch:template
    name: Fetch policy template
    input:
      url: ./templates/policy-bundle
      targetPath: policies/compliance
      values:
        policySet: "baseline"

  - id: signedReview
    action: publish:gerrit:review
    name: Create signed Gerrit review
    input:
      repoUrl: gerrit.acme.corp?project=security/policies
      branch: main
      sourcePath: policies/compliance
      gitCommitMessage: "feat(policy): add baseline compliance policies"
      gitAuthorName: "Compliance Automation"
      gitAuthorEmail: "[email protected]"
      signCommit: true

  - id: logSignedReview
    action: debug:log
    name: Log review URL
    input:
      message: "Signed review: ${{ steps.signedReview.output.reviewUrl }}"

Propose a hotfix against a release branch

Applies a small patch and opens a review against a release branch. Use this for urgent fixes that should target a maintained release line.

Copy
steps:
  - id: fetchPatch
    action: fetch:template
    name: Fetch patch files
    input:
      url: ./templates/patch
      targetPath: .
      values:
        cveId: ${{ parameters.cveId }}

  - id: releaseReview
    action: publish:gerrit:review
    name: Create Gerrit review for release branch
    input:
      repoUrl: gerrit.acme.corp?project=retail/web-storefront
      branch: release/1.2.x
      gitCommitMessage: "fix(security): patch ${{ parameters.cveId }} in storefront"

  - id: logReleaseReview
    action: debug:log
    name: Log review URL
    input:
      message: "Release branch review: ${{ steps.releaseReview.output.reviewUrl }}"

Parameterized review creation for different projects and branches

Takes repo and branch from user input to create a review, optionally limited to a chosen subdirectory. Use this when the template should support multiple Gerrit projects.

Copy
steps:
  - id: fetchCustom
    action: fetch:template
    name: Fetch chosen template
    input:
      url: ${{ parameters.templateUrl }}
      targetPath: ${{ parameters.targetPath }}
      values:
        name: ${{ parameters.componentId }}

  - id: parameterizedReview
    action: publish:gerrit:review
    name: Create Gerrit review from parameters
    input:
      repoUrl: ${{ parameters.repoUrl }} # e.g. gerrit.acme.corp?project=platform/shared-libs
      branch: ${{ parameters.branch }}   # e.g. main or develop
      sourcePath: ${{ parameters.sourcePath }} # e.g. libs/${{ parameters.componentId }}
      gitCommitMessage: "${{ parameters.commitMessage }}"
      gitAuthorName: ${{ parameters.authorName }}
      gitAuthorEmail: ${{ parameters.authorEmail }}

  - id: logParameterized
    action: debug:log
    name: Log review and repo URLs
    input:
      message: "Review: ${{ steps.parameterizedReview.output.reviewUrl }} Repo: ${{ steps.parameterizedReview.output.repoContentsUrl }}"