Pushes changes to a specified GitLab repository branch with a defined commit message and action.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| token | string | The token to use for authorization to GitLab | |
| repoUrl | string | - | |
| branchName | string | The branch name for the commit | |
| sourcePath | string | Subdirectory of working directory to copy changes from | |
| targetPath | string | Subdirectory of repository to apply changes to | |
| commitAction | string | - | |
| commitMessage | string | - |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| projectid | string | Gitlab Project id/Name(slug) | |
| commitHash | string | The git commit hash of the commit | |
| projectPath | string | Gitlab Project path |
Usage Examples
Push generated service files to a new feature branch
Pushes newly generated service files to a GitLab repository on a feature branch. Use this after rendering files with fetch:template.
steps:
- id: fetchServiceTemplate
action: fetch:template
input:
url: ./templates/service
targetPath: ./generated/service
values:
name: ${{ parameters.serviceName }}
owner: platform-team
- id: pushServiceScaffold
action: gitlab:repo:push
input:
repoUrl: gitlab.com?owner=platform&repo=${{ parameters.serviceSlug }}
branchName: feature/bootstrap-ci
commitMessage: "Add CI and catalog files for ${{ parameters.serviceName }}"
sourcePath: generated/service
targetPath: .
commitAction: createUpdate documentation in the docs folder
Updates existing files under the docs directory using a dedicated branch. Use this to publish generated docs artifacts, with credentials passed via a secret.
steps:
- id: buildDocs
action: fetch:template
input:
url: ./templates/docs
targetPath: ./docs-build
values:
service: ${{ parameters.serviceName }}
repo: ${{ parameters.repoName }}
- id: pushDocsUpdate
action: gitlab:repo:push
input:
repoUrl: gitlab.com?owner=${{ parameters.repoOwner }}&repo=${{ parameters.repoName }}
branchName: docs/update-${{ parameters.serviceSlug }}
commitMessage: "Update service documentation"
sourcePath: docs-build
targetPath: docs
commitAction: update
token: ${{ secrets.gitlabToken }}Delete a legacy directory from the repository
Removes an obsolete directory from the repo on a chore branch. Use this when cleaning up deprecated manifests or assets.
steps:
- id: removeLegacyManifests
action: gitlab:repo:push
input:
repoUrl: gitlab.com?owner=platform&repo=payments
branchName: chore/remove-legacy-k8s
commitMessage: "Remove legacy Kubernetes manifests"
targetPath: k8s/overlays/dev-old
commitAction: delete
token: ${{ secrets.gitlabToken }}Update a nested package folder in a monorepo
Updates files under a nested package path in a monorepo. Use this after generating code into a workspace subfolder with fetch:template.
steps:
- id: generateApiClient
action: fetch:template
input:
url: ./templates/api-client
targetPath: ./gen/api-client
values:
apiSpecUrl: ${{ parameters.openapiUrl }}
- id: pushApiClientUpdate
action: gitlab:repo:push
input:
repoUrl: gitlab.com?owner=${{ parameters.groupPath }}&repo=${{ parameters.repoName }}
branchName: feature/update-api-client
commitMessage: "Regenerate API client from ${{ parameters.openapiUrl }}"
sourcePath: gen/api-client
targetPath: packages/api-client
commitAction: update
token: ${{ secrets.gitlabToken }}Create a release branch with versioned release notes
Adds new release notes under a versioned path on a release branch. Use this to publish release artifacts created via fetch:template.
steps:
- id: generateReleaseNotes
action: fetch:template
input:
url: ./templates/release-notes
targetPath: ./release-notes
values:
version: ${{ parameters.version }}
changes: ${{ parameters.changelog }}
- id: pushReleaseNotes
action: gitlab:repo:push
input:
repoUrl: gitlab.com?owner=${{ parameters.repoOwner }}&repo=${{ parameters.repoName }}
branchName: release/${{ parameters.version }}
commitMessage: "Add release notes for ${{ parameters.version }}"
sourcePath: release-notes
targetPath: docs/releases/${{ parameters.version }}
commitAction: create