README.md
March 24, 2026 ยท View on GitHub
Git Pull Request event trigger with set PR/MR commit status
This sample-git-pr-status sub-directory contains several EventListener definitions that you can include in your CD tekton pipeline configuration to run an example demonstrating the usage of the git-set-commit-status in the context of a CD Tekton pipeline triggered by a Git Pull Request event (PullRequest push/update).
This sample illustrates the PullRequest support provided by the git-clone-repo that results in a Git repository content that would be identical to the one obtained after a merge action on the given PullRequest (or Merge Request for a Gitlab or GRIT server).
It is also showcase the git-set-commit-statusto create/update Pull Request status check (i.e. set commit status on the last commit of the Pull Request).
The status being sucess or failing according to the commit message (it the commit message contains fail then the status is failed otherwise it is success)
-
Create or update a Toolchain to include:
- the github.com repository that you want to clone
- (optional) the GRIT repository that you want to clone
- (optional) the BitBucket repository that you want to clone
- the repository containing this Tekton task
- a Tekton pipeline definition

-
Add the definitions of this task and the sample (
gitandgit/sample-git-pr-statuspaths)
-
Add the environment properties:
apikey: the API key used for the ibmcloud login/access

-
Create Git Triggers for the different Git repositories that you have integrated to your Toolchain (corresponding to the repositories integrated to your Toolchain).
Github:
-
eventlistener-git-pr-status-github-prfor Github PullRequest opened/updated event
GRIT/Gitlab:
eventlistener-git-pr-status-grit-mrfor GRIT/Gitlab MergeRequest opened/updated event
BitBucket:
eventlistener-git-pr-status-bitbucket-prfor BitBucket PullRequest opened/updated event
-
-
Trigger on PullRequest: in one of your repository that has the above triggers defined, define a new Git branch, push some code changes and create a new PullRequest to the default
masterbranch.

Observe: a new pipeline run is automatically started, triggered by this PullRequest.

Notes:
- The
clone-taskexecution will produce the same repository content as the "Merge Pull Request" action/button would. - The
set-git-commit-statustask execution will use theinspect-git-commit-messagepipelinerun task execution status to update the PullRequest commit status

The Pull Request status check is updated as the last commit has a commit status

Note: in case of a commit message containing
failthe task will result in a failure and thefinallyclause in the pipeline definition will still execute theset-git-commit-statustask with the appropriate state
The Pull Request status check is updated to failure corresponding to the last commit status

- The
Detailed Description
This pipeline and relevant trigger(s) can be configured using the properties described below.
See https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-tekton-pipelines&interface=ui#configure_tekton_pipeline for more information.
EventListeners:
- eventlistener-git-pr-status-github-pr - github pull-request listener to set status on pull-request commit
- eventlistener-git-pr-status-grit-mr - grit/gitlab merge-request listener to set status on merge-request commit
- eventlistener-git-pr-status-bitbucket-pr - bitbucket pull-request listener to set status on pull-request commit
eventlistener-git-pr-status-github-pr
EventListener: eventlistener-git-pr-status-github-pr - github pull-request listener to set status on pull-request commit
| Properties | Description | Default | Required | Type |
|---|---|---|---|---|
apikey (secured property) | the api key used to login to ibmcloud | - | Yes | secret |
branch | the branch for the git repo | $(event.pull_request.base.ref) | No | string |
context | - | commit message check | No | string |
description | - | verify the commit message | No | string |
git-access-token | the token to access the git repository for the clone operations | `` | No | string |
git-credentials-json-file | - | output/secrets/thecredentials.json | No | string |
pipeline-debug | Pipeline debug mode. Value can be 0 or 1. | 0 | No | string |
pr-branch | The source branch for the PullRequest | $(event.pull_request.head.ref) | No | string |
pr-repository | The source git repo for the PullRequest | $(event.pull_request.head.repo.clone_url) | No | string |
pr-revision | the commit id/sha for the PullRequest | $(event.pull_request.head.sha) | No | string |
properties-file | - | output/thebuild.properties | No | string |
repository | the git repo | $(event.pull_request.base.repo.clone_url) | No | string |
triggerName | name of the trigger | github-pullrequest | No | string |
eventlistener-git-pr-status-grit-mr
EventListener: eventlistener-git-pr-status-grit-mr - grit/gitlab merge-request listener to set status on merge-request commit
| Properties | Description | Default | Required | Type |
|---|---|---|---|---|
apikey (secured property) | the api key used to login to ibmcloud | - | Yes | secret |
branch | the branch for the git repo | $(event.object_attributes.target_branch) | No | string |
context | - | commit message check | No | string |
description | - | verify the commit message | No | string |
git-access-token | the token to access the git repository for the clone operations | `` | No | string |
git-credentials-json-file | - | output/secrets/thecredentials.json | No | string |
pipeline-debug | Pipeline debug mode. Value can be 0 or 1. | 0 | No | string |
pr-branch | The source branch for the PullRequest | $(event.object_attributes.source_branch) | No | string |
pr-repository | The source git repo for the PullRequest | $(event.object_attributes.source.git_http_url) | No | string |
pr-revision | the commit id/sha for the PullRequest | $(event.object_attributes.last_commit.id) | No | string |
properties-file | - | output/thebuild.properties | No | string |
repository | the git repo | $(event.object_attributes.target.git_http_url) | No | string |
triggerName | name of the trigger | grit-mergerequest | No | string |
eventlistener-git-pr-status-bitbucket-pr
EventListener: eventlistener-git-pr-status-bitbucket-pr - bitbucket pull-request listener to set status on pull-request commit
| Properties | Description | Default | Required | Type |
|---|---|---|---|---|
apikey (secured property) | the api key used to login to ibmcloud | - | Yes | secret |
branch | the branch for the git repo | $(event.pullrequest.destination.branch.name) | No | string |
context | - | commit message check | No | string |
description | - | verify the commit message | No | string |
git-access-token | the token to access the git repository for the clone operations | `` | No | string |
git-credentials-json-file | - | output/secrets/thecredentials.json | No | string |
pipeline-debug | Pipeline debug mode. Value can be 0 or 1. | 0 | No | string |
pr-branch | The source branch for the PullRequest | $(event.pullrequest.source.branch.name) | No | string |
pr-repository | The source git repo for the PullRequest | $(event.pullrequest.source.repository.links.html.href) | No | string |
pr-revision | the commit id/sha for the PullRequest | $(event.pullrequest.source.commit.hash) | No | string |
properties-file | - | output/thebuild.properties | No | string |
repository | the git repo | $(event.pullrequest.destination.repository.links.html.href) | No | string |
triggerName | name of the trigger | bitbucket-pullrequest | No | string |