Skip to content

benlei/find-merged-pull-request

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

benlei/find-merged-pull-request

GitHub Super-Linter CI Check dist/ CodeQL Coverage

This action can be used to try to match the current commit of the running workflow to a closed (merged) pull request. This can be useful for workflows where you need information about the pull request that was just merged but can't use the pull_request event due to the limitations around the event.

Inputs

Name Required Default Description
token no ${{ github.token }} GitHub token to use for API requests.
page-limit no 1 The maximum number of pages to search for a matching pull request.

Outputs

Name Description
number The number of the pull request that was merged.
title The title of the pull request that was merged.
body The body of the pull request that was merged.
labels The labels of the pull request that was merged, separated by commas.
labels-json The labels of the pull request that was merged, in JSON format.
user The user that opened the pull request that was merged.
assignees The assignees of the pull request that was merged, separated by commas.
assignees-json The assignees of the pull request that was merged, in JSON format.
milestone The milestone of the pull request that was merged.
merged_by The user that merged the pull request that was merged.

Example usage

- name: Get merged pull request
  id: merged
  uses: benlei/find-merged-pull-request@v1
  with:
    token: ${{ secrets.GITHUB_TOKEN }}

- name: Send a message if the merged pull request contains a 'fix' label
  if: ${{ contains(fromJSON(steps.merged.outputs.labels-json), 'fix') }}
  run: echo "The merged pull request contains a 'fix' label."

About

Tries to get the merged pull request

Resources

License

Stars

Watchers

Forks

Packages

No packages published