This is a very basic GitHub Action to simply create a GitHub Pull Request form an existing branch of the given repository to another one. This Action does not commit any of your changes, nor does it create any of the branches it uses. All this action does is create a Pull Request, nothing more.
Note
This Action took inspiration of several other PR creating and updating Actions, however none of them seemed to be doing what I needed, so this exists now.
Action I/O
Tip
It is recommended that you lock down the permissions granted to the default GITHUB_TOKEN within any workflow you have in your repositories.
This action will need at least these permissions set on the workflow it runs in:
permissions:
contents: readpull-requests: write
Action Inputs
Input
Required
Description
token
true
The GitHub Token to use by this Action (e.g. ${{ secrets.GITHUB_TOKEN }})
pr_title
true
The title of the PR that should be created/updated (e.g. My awesome PR)
pr_source
true
The source branch name the PR should have (this branch needs to already exist in the repository)
pr_target
false
The target branch name the PR should have (defaults to the default branch of the repo)
pr_body
false
The body of the PR to create (e.g. My very useful PR description)
A comma separated list of labels to add to the PR (e.g. label0,label1)
pr_assignees
false
A comma separated list of assignees to add to the PR (e.g. octocat)
Action Outputs
Output
Description
pr_nr
The number of the created/updated PR
Usage
create-or-update-pr.yml
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-lateststeps:
- name: Checkout Repouses: actions/checkout@v2
- name: Do some changes to the reporun: ...
- name: Run Git CCommandsrun: | git checkout -b branch_name git commit -am 'add som stuff' git push origin
- name: Create-Update PRuses: k3rnels-actions/pr-update@v1id: pr_updatewith:
token: ${{ secrets.GITHUB_TOKEN }}pr_title: Awsome PRpr_source: branch_namepr_body: | ### Description Yes you can use Markdown here too ### Changes The following features have been added:\r\npr_body_with_links: true
- name: Upload Artifactrun: echo "${{ steps.pr_update.outputs.pr_nr }}"
Contribute
All kinds of contributions are more than welcome! However, if you plan bigger changes please open an issue first to discuss your proposed changes ๐
Licence
Just if the badge from shields.io and the LICENSE file do not make it obvious enough, this project is licenced under the GPLv3 or later.
Is your feature request related to a problem? Please describe.
As an software engineer working with multiple team members using staging branch for testing, I want to have an improved and automated visualisation of code changes that my co-workers made.
Describe the solution you'd like
Assuming we have pr_body_with_links input that is explicit set to true:
Every PR that contributed to the prSource is linked in the body of the automated created feature PR from prSource to prTarget
As long as prTarget is not merged, every time a new PR is merged into prSource the body of the feature PR from prSource to prTarget gets updated and appends the new changes
Describe alternatives you've considered
Using a company built/closed source bash script solution that is hard to maintain.
Is your feature request related to a problem? Please describe.
This Action could offer the user a setting to check for changes before updating the PR, that would elevate asserting this in some cases and still allow user to only update the text body, title, labels and assignees of a PR.
Describe the solution you'd like
A extra config-option to enable a 'git diff check' before fairing a PR update.
Describe alternatives you've considered
Have a extra step in every workflow that wants to check for diffs first before updating a given PR.