Skip to content

A GitHub Action to automatically approve your own pull request for a protected branch using a GitHub App.

License

Notifications You must be signed in to change notification settings

nicklegan/github-repo-self-approve-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Repository Self-Approve Action

A GitHub Action to automatically approve your own pull request for a protected branch using a GitHub App.

Usage

name: Self-Approve Action

on:
  pull_request:

jobs:
  self-approve-action:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Self-Approve Action
        uses: nicklegan/[email protected]
        if: github.actor == 'your-username'
        with:
          appid: ${{ secrets.APPID }}
          privatekey: ${{ secrets.PRIVATEKEY }}
          installationid: ${{ secrets.INSTALLATIONID }}

GitHub App

Register a new organization or personal owned GitHub App with the below permissions:

GitHub App Permission Access
Repository Permissions:Contents read and write
Repository Permissions:Pull requests read and write

After registration install the GitHub App to your organization. Store the below App values as secrets.

GitHub secrets

Name Value Required
APPID GitHub App ID number true
PRIVATEKEY Content of private key .pem file true
INSTALLATIONID GitHub App installation ID number true

Finally set your GitHub username as the github.actor conditional value within the workflow file.

💡 The GitHub App name will be used as the name for the approving reviewer.

Action inputs

Name Description Default Options Required
github.actor Approve pull requests created by the user specified workflow.yml false

About

A GitHub Action to automatically approve your own pull request for a protected branch using a GitHub App.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks