# githubGetCommitPrs

This step sets gets PRs associated with a commit.

> Lists the merged pull request that introduced the commit to the repository. If the commit is not present in the default branch, it will return merged and open pull requests associated with the commit.

[reference](https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit)

## Parameters

| Name          | Description                                                                   | Type     | Default          | Required |
| ------------- | ----------------------------------------------------------------------------- | -------- | ---------------- | -------- |
| repo          | The Github repository name                                                    | `String` | n/a              | yes      |
| commitSha     | Git commit hash                                                               | `String` | n/a              | yes      |
| owner         | The Github repository owner                                                   | `String` | 'theorchard'     | no       |


## Usage


### Get PRs Associated with Commit

```groovy
stage('Some task') {
    steps {
        def response = githubGetCommitPrs(
            repo: 'ows-app',
            commitSha: env.GIT_COMMIT
        )
        def prNumber = response[0].number
        ...
    }
}
```
