Coder Social home page Coder Social logo

peter-evans_rebase's Introduction

Rebase

CI GitHub Marketplace

A GitHub action to rebase pull requests in a repository.

Usage

The default behaviour of the action with no configured inputs is to check the current repository for rebaseable pull requests and rebase them. Pull requests from forks are rebaseable only if they allow edits from maintainers.

      - uses: peter-evans/rebase@v2

Periodically rebase all pull requests

The simplest way to use this action is to schedule it to run periodically.

name: Rebase
on:
  schedule:
    - cron:  '0 0 * * *'
jobs:
  rebase:
    runs-on: ubuntu-latest
    steps:
      - uses: peter-evans/rebase@v2

Rebase all pull requests on push to the base branch

name: Rebase
on:
  push:
    branches: [main]
jobs:
  rebase:
    runs-on: ubuntu-latest
    steps:
      - uses: peter-evans/rebase@v2
        with:
          base: main

Exclude pull requests with specific labels

      - uses: peter-evans/rebase@v2
        with:
          exclude-labels: |
            no-rebase
            dependencies

Exclude pull request forks with head filter

      - uses: peter-evans/rebase@v2
        with:
          head: 'my-org:*'

Action inputs

Name Description Default
token GITHUB_TOKEN or a repo scoped PAT. The workflow scope may also be required if rebasing pull requests containing changes to workflows under .github/workflows. GITHUB_TOKEN
repository The target GitHub repository containing the pull request. github.repository (Current repository)
head Filter pull requests by head user or head organization and branch name in the format user:ref-name or organization:ref-name. Use the * wildcard match any ref. e.g. my-org:new-script-format or octocat:*.
base Filter pull requests by base branch name. Example: gh-pages.
include-labels A comma or newline separated list of pull request labels to include. Allows any labels if unspecified.
exclude-labels A comma or newline separated list of pull request labels to exclude.
exclude-drafts Exclude draft pull requests. false

Rebase slash command

Use the following two workflows and a repo scoped PAT to add a /rebase slash command to pull request comments. The slash-command-dispatch action makes sure that the command is only executable by users with write access to the repository.

name: Slash Command Dispatch
on:
  issue_comment:
    types: [created]
jobs:
  slashCommandDispatch:
    runs-on: ubuntu-latest
    steps:
      - name: Slash Command Dispatch
        uses: peter-evans/slash-command-dispatch@v3
        with:
          token: ${{ secrets.PAT }}
          commands: rebase
          permission: write
          issue-type: pull-request
name: rebase-command
on:
  repository_dispatch:
    types: [rebase-command]
jobs:
  rebase:
    runs-on: ubuntu-latest
    steps:
      - uses: peter-evans/rebase@v2
        id: rebase
        with:
          head: ${{ github.event.client_payload.pull_request.head.label }}
      - name: Add reaction
        if: steps.rebase.outputs.rebased-count == 1
        uses: peter-evans/create-or-update-comment@v1
        with:
          token: ${{ secrets.PAT }}
          repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
          comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
          reaction-type: hooray

Target other repositories

You can rebase requests in another repository by using a repo scoped PAT instead of GITHUB_TOKEN. The user associated with the PAT must have write access to the repository.

This example targets multiple repositories.

name: Rebase
on:
  schedule:
    - cron:  '0 0 * * *'
jobs:
  rebase:
    strategy:
      matrix:
        repo: ['my-org/repo1', 'my-org/repo2', 'my-org/repo3']
    runs-on: ubuntu-latest
    steps:
      - uses: peter-evans/rebase@v2
        with:
          token: ${{ secrets.PAT }}
          repository: ${{ matrix.repo }}

License

MIT

peter-evans_rebase's People

Contributors

actions-bot avatar dependabot[bot] avatar peter-evans avatar

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.