GitHub Action
Reliable Pull Request Action
v1.2.0
Latest version
*Only uses built-in GitHub runner commands
- Create a pull request on a GitHub repository using existing branches.
- actions/checkout determins the active repo.
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:
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:
PRURL:
description: 'The URL of the created pull request'
The following permissions must be set for the repository:
Settings > Actions > General
- Workflow permissions
- Read and write permissions
- Allow GitHub Actions to create and approve pull requests
- Save
- Workflow permissions
Alternative is to set jobs.<job_id>.permissions