☞ Github Actions to create pull request using Github CLI
Note: This action is supported on all runners operating systems (ubuntu
, macos
, windows
)
Inspired from https://github.com/repo-sync/pull-request
Original Code from github.com/GuillaumeFalourd/pull-request-action
-
Create pull requests
-
Add reviewers, assignees, labels, or milestones
-
Customize pull request title and body
-
Fail silently when a pull request already exists
-
This action uses Github CLI to create a Pull Request.
-
According to the documentation, to authenticate on the workflow using Github CLI, you need to set the GITHUB_TOKEN context variable as environment variable.
-
Note that if you need specific permissions, you can also set a Personal Access Token instead.
- uses: datadrivers/pull-request-action@v2
with:
destination_branch: "main"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: datadrivers/pull-request-action@v2
with:
source_branch: "main" # If blank, default: triggered branch
destination_branch: "feature" # If blank, default: main
pr_title: "Pulling ${{ github.ref }} into main" # Title of pull request
pr_body: "An automated PR" # Full markdown support, requires pr_title to be set
pr_reviewer: "john, britney" # Comma-separated list (no spaces)
pr_assignee: "john" # Comma-separated list (no spaces)
pr_label: "auto-pr" # Comma-separated list (no spaces)
pr_milestone: "Milestone 1" # Milestone name
pr_draft: true # Creates pull request as draft
pr_allow_empty: true # Creates pull request even if there are no changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Can use PAT as secret
Field | Observation |
---|---|
pr_url |
Pull request URL |
pr_number |
Pull request number |
has_changed_files |
Boolean string indicating whether any file has been changed |
pr_created |
Boolean string indicating whether a PR was created |
☞ If you're interested in contributing to this repository, please follow the guidelines
☞ This repository uses the Apache License 2.0