Skip to content

Latest commit

 

History

History
106 lines (95 loc) · 5.62 KB

pulls-create.md

File metadata and controls

106 lines (95 loc) · 5.62 KB

Create pull request

A composite action for creating a github pull request. This requires pull-requests: write permissions in order to work correctly.

Inputs

Name Description Default
head (*) The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch N/A
title (*) The title to use for the issue N/A
assignees A list of assignees to add, separated by newlines. ""
base The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository. ""
body The body text of the github issue ""
draft Indicates whether the pull request is a draft. See "Draft Pull Requests" in the GitHub Help documentation to learn more. "false"
github-token The default token to use for this Git operation. If unspecified, this will default to github.token. "${{ github.token }}"
head-repo The name of the repository where the changes in the pull request were made. This field is required for cross-repository pull requests if both repositories are owned by the same organization. ""
issue An issue in the repository to convert to a pull request. The issue title, body, and comments will become the title, body, and comments on the new pull request. Required unless title is specified. "0"
labels A list of labels to add, separated by newlines. ""
maintainer-can-modify Indicates whether maintainers can modify the pull request. "true"
owner The repository owner. If unspecified, this will default to the owner of the current repository. ""
repo The name of the repository. If unspecified, this will default to the current repository. ""
retries The number of times to attempt to retry if this fails. "0"
retry-exempt-status-codes A list of error-codes that are exempt from being retried. "400,401,403,404,422"

Note: (*) marks required inputs

Outputs

Name Description
assignees The assignee(s) for this pull requst, as a JSON array of string logins
assignees-count The number of assignee(s) for this pull requst
body The body of this PR
draft Whether the PR is a draft PR
labels The labels assigned to this PR, as a JSON array of label names
labels-count The number of labels assigned to this PR
locked Whether this issue is currently locked
merged Whether the PR is merged.
pull-number The pull request number
state The state of this PR
team-reviewers The team revieweers for this pull requst, as a JSON array of string logins
team-reviewers-count The number of team reviewers assigned to this pull request
time-since-create The amount of time since the pull request was created
time-since-last-update The amount of time since the pull request was last updated
title The title of this PR
user-reviewers The user reviewers for this pull requst, as a JSON array of string logins
user-reviewers-count The number of user reviewers assigned to this pull request

Example

Here is a very basic example of how to use the pulls/create composite action in a project (placeholders are used in place of real inputs):

run:
  example-job:
    # ... 
    steps:
      # ... 
      - name: Create pull request
        id: pulls-create # only necessary if using this action's output(s)
        uses: bitwizeshift/actions-github/pulls/create@v1
        with:
          # Required inputs
          head: HEAD
          title: TITLE

          # Optional inputs
          assignees: ASSIGNEES
          base: BASE
          body: BODY
          draft: DRAFT
          github-token: GITHUB_TOKEN
          head-repo: HEAD_REPO
          issue: ISSUE
          labels: LABELS
          maintainer-can-modify: MAINTAINER_CAN_MODIFY
          owner: OWNER
          repo: REPO
          retries: RETRIES
          retry-exempt-status-codes: RETRY_EXEMPT_STATUS_CODES
      # ... 
      - name: Uses "Create pull request" Outputs
        uses: example-actions/use-pulls-create@v3 # illustrative
        with:
          use-assignees: ${{ steps.pulls-create.outputs.assignees }}
          use-assignees-count: ${{ steps.pulls-create.outputs.assignees-count }}
          use-body: ${{ steps.pulls-create.outputs.body }}
          use-draft: ${{ steps.pulls-create.outputs.draft }}
          use-labels: ${{ steps.pulls-create.outputs.labels }}
          use-labels-count: ${{ steps.pulls-create.outputs.labels-count }}
          use-locked: ${{ steps.pulls-create.outputs.locked }}
          use-merged: ${{ steps.pulls-create.outputs.merged }}
          use-pull-number: ${{ steps.pulls-create.outputs.pull-number }}
          use-state: ${{ steps.pulls-create.outputs.state }}
          use-team-reviewers: ${{ steps.pulls-create.outputs.team-reviewers }}
          use-team-reviewers-count: ${{ steps.pulls-create.outputs.team-reviewers-count }}
          use-time-since-create: ${{ steps.pulls-create.outputs.time-since-create }}
          use-time-since-last-update: ${{ steps.pulls-create.outputs.time-since-last-update }}
          use-title: ${{ steps.pulls-create.outputs.title }}
          use-user-reviewers: ${{ steps.pulls-create.outputs.user-reviewers }}
          use-user-reviewers-count: ${{ steps.pulls-create.outputs.user-reviewers-count }}