Easily create a Pull Request from a GitHub Action.
This action assumes you have already created a commit in a head branch.
All the other Inputs have defaults.
- name: 'Create Pull'
uses: cssnr/create-pull-action@master
with:
head: feature-branchSee the Inputs for more options.
🚀 Created as an alternative to using the gh cli or api.
- Simple
- Defaults
âś… Only the head branch is required.
| Input | Default Value | Input Description |
|---|---|---|
repository |
github.repository |
Repository owner/name |
head |
Required | Head Branch |
base |
default_branch |
Base Branch |
title |
Changes from {Name} |
Pull Request Title |
body |
Triggered by {user} in workflow {Name}. |
Pull Request Body |
token |
github.token |
Token for repository |
summary |
true |
Add Job Summary |
- name: 'Create Pull'
uses: cssnr/create-pull-action@master
with:
repository: some/other-repository # optional
head: feature-branch
base: master # optional
title: Ralf Broke It # optional
body: Broken ${{ github.run_number }} times. # optional
token: ${{ secrets.ACCESS_TOKEN }} # see permissionsđź”’ This action requires the following workflow permissions if the repository is the same.
permissions:
pull-request: writeIf the workflow is in a different repository you need to create an Access Token.
The Personal, Fine-Grained or App Token needs these permissions on the repository.
permissions:
pull-request: write
contents: read # to determine base branch if privatePermissions documentation for Workflows, Actions and Apps.
📤 The pull request response data is accessible via outputs.
| Output | Description |
|---|---|
pull |
Pull Request JSON |
html_url |
Pull Request HTML URL |
id |
Pull Request ID |
number |
Pull Request Number |
Everything is available in the pull json. The other outputs are parsed from this object.
- name: 'Create Pull Action'
id: pull
uses: cssnr/create-pull-action@master
with:
head: feature-branch
- name: 'Echo Output'
run: |
echo "html_url: ${{ steps.pull.outputs.html_url }}"
echo "html_url: ${{ fromJSON(steps.pull.outputs.pull).html_url }}"The following rolling tags are maintained.
| Version Tag | Rolling | Bugs | Feat. | Name | Target | Example |
|---|---|---|---|---|---|---|
| âś… | âś… | âś… | Major | vN.x.x |
vN |
|
| ✅ | ✅ | ❌ | Minor | vN.N.x |
vN.N |
|
| ❌ | ❌ | ❌ | Micro | vN.N.N |
vN.N.N |
You can view the release notes for each version on the releases page.
The Major tag is recommended. It is the most up-to-date and always backwards compatible. Breaking changes would result in a Major version bump. At a minimum you should use a Minor tag.
If you run into any issues or need help getting started, please do one of the following:
- Report an Issue: https://github.com/cssnr/create-pull-action/issues
- Q&A Discussion: https://github.com/cssnr/create-pull-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/create-pull-action/issues/new?template=1-feature.yaml
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
For more information, see the CSSNR SUPPORT.md.
If you would like to submit a PR, please review the CONTRIBUTING.md.
Please consider making a donation to support the development of this project and additional open source projects.
Additionally, you can support other GitHub Actions I have published:
- Stack Deploy Action
- Portainer Stack Deploy Action
- Docker Context Action
- Actions Up Action
- Rhysd Actionlint Action
- Zensical Action
- VirusTotal Action
- Mirror Repository Action
- Update Version Tags Action
- Docker Tags Action
- TOML Action
- Update JSON Value Action
- JSON Key Value Check Action
- Parse Issue Form Action
- Cloudflare Purge Cache Action
- Mozilla Addon Update Action
- Package Changelog Action
- NPM Outdated Check Action
- Label Creator Action
- Algolia Crawler Action
- Upload Release Action
- Check Build Action
- Web Request Action
- Get Commit Action
âť” Unpublished Actions
These actions are not published on the Marketplace, but may be useful.
- cssnr/create-pull-action - Create a pull request.
- cssnr/create-files-action - Create various files from templates.
- cssnr/draft-release-action - Keep a draft release ready to publish.
- cssnr/homebrew-action - Homebrew formula update action.
- cssnr/env-json-action - Convert env file to json or vice versa.
- cssnr/push-artifacts-action - Sync files to a remote host with rsync.
- smashedr/update-release-notes-action - Update release notes.
- smashedr/combine-release-notes-action - Combine release notes.
📝 Template Actions
These are basic action templates that I use for creating new actions.
- javascript-action - JavaScript
- typescript-action - TypeScript
- py-test-action - Dockerfile Python
- test-action-uv - Dockerfile Python UV
- docker-test-action - Docker Image Python
Note: The docker-test-action builds, runs and pushes images to GitHub Container Registry.
For a full list of current projects visit: https://cssnr.github.io/
