Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
git-pull-request

GitHub Action

Reliable Pull Request Action

v1.1.0

Reliable Pull Request Action

git-pull-request

Reliable Pull Request Action

Creates a pull request on a GitHub repository using existing branches

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Reliable Pull Request Action

uses: JosiahSiegel/[email protected]

Learn more about this action in JosiahSiegel/reliable-pull-request-action

Choose a version

Reliable* Pull Request Action

*Only uses built-in GitHub runner commands

Test Action

Synopsis

  1. Create a pull request on a GitHub repository using existing branches.
  2. actions/checkout determins the active repo.

Usage

jobs:
  create-pr:
    name: Test create PR on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
    steps:
      - name: Checkout the repo
        uses: actions/[email protected]

      - name: Create Pull Request
        id: create_pr
        uses: JosiahSiegel/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          title: 'Automated Pull Request'
          sourceBranch: ${{ github.ref_name }}
          targetBranch: 'main'
          body: 'This is an automated pull request.'
          labels: 'automated,pr'
          assignees: 'octocat'

      - name: Output PR URL
        run: echo "The PR URL is ${{ steps.create_pr.outputs.PRURL }}"

Inputs

inputs:
  title:
    description: 'Pull Request Title'
    required: true
  sourceBranch:
    description: 'Source Branch Name'
    required: true
  targetBranch:
    description: 'Target Branch Name'
    required: true
  body:
    description: 'Pull Request Body'
    required: false
  labels:
    description: 'Labels (comma-separated)'
    required: false
  assignees:
    description: 'Assignees (comma-separated)'
    required: false

Outputs

outputs:
  PRURL:
    description: 'The URL of the created pull request'

Requirements

The following permissions must be set for the repository:

  • Settings > Actions > General
    • Workflow permissions
      1. Read and write permissions
      2. Allow GitHub Actions to create and approve pull requests
      3. Save

Alternative is to set jobs.<job_id>.permissions