Git Product home page Git Product logo

pr-update's Introduction

PR-Update

GitHub Workflow Status CodeFactor Maintenance status License GitHub release (latest by date)

Introduction

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: read
  pull-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)

pr_body_with_links

false

When enabled appends links of associated PRs to the body of the PR to create (e.g. - [My new feature](https://github.com/k3rnels-actions/pr-update/pulls/1))

pr_labels

false

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-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v2
      - name: Do some changes to the repo
        run: ...
      - name: Run Git CCommands
        run: |
          git checkout -b branch_name
          git commit -am 'add som stuff'
          git push origin
      - name: Create-Update PR
        uses: k3rnels-actions/pr-update@v1
        id: pr_update
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          pr_title: Awsome PR
          pr_source: branch_name
          pr_body: |
            ### Description
            Yes you can use Markdown here too
            ### Changes
            The following features have been added:\r\n
          pr_body_with_links: true

      - name: Upload Artifact
        run: 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

gplv3 or later

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.

pr-update's People

Contributors

dependabot[bot] avatar h1dden-da3m0n avatar k3rnelpan1c-dev avatar renovate[bot] avatar sushie1984 avatar susonthapa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pr-update's Issues

[F] Update PR body for closed PR

Can you add functionality for updating PR body for closed PR. After merge and close PR our pr_source branch is removed and can't update PR body.

image

Feature automated body PR links

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.

Additional context

See #166 for possible solutation

[F] Optional Diff Check before updating PRs

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.

Additional context

n/a

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/label-sync.yaml
  • EndBug/label-sync v2.3.2@da00f2c11fdb78e4fae44adac2fdd713778ea3e8
.github/workflows/test.yaml
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4.0.0@8f152de45cc393bb48ce5d89d36b731f54556e65
  • actions/upload-artifact v3.1.3@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/download-artifact v3.0.2@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/download-artifact v3.0.2@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
npm
package.json
  • @actions/core 1.10.0
  • @actions/exec 1.1.1
  • @actions/github 5.1.1
  • @types/node 16.18.38
  • @types/jest 29.5.2
  • @typescript-eslint/eslint-plugin 5.61.0
  • @typescript-eslint/parser 5.61.0
  • @vercel/ncc 0.36.1
  • eslint 8.44.0
  • eslint-plugin-github 4.8.0
  • eslint-plugin-jest 27.2.2
  • jest 29.6.1
  • js-yaml 4.1.0
  • prettier 2.8.8
  • ts-jest 29.1.1
  • typescript 5.1.6
  • husky 8.0.3

  • Check this box to trigger a request for Renovate to run again on this repository

[B] Broken CI tests for PRs

Describe the bug

CI is broken for now, as it seems that GitHub changed which branch gets checked out for the pull_request_target events ๐Ÿ˜’

To Reproduce

Create a PR with purposefully incorrect tests.

Expected behaviour

Tests to run on the PR branch and validate changes.

Action Config and Log

n/a

Versions (please complete the following information):

  • Action Version: n/a
  • Action Environment: n/a

Additional context

n/a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.