Skip to content
check

GitHub Action

Repo Permission Check Action

2.0.2 Latest version

Repo Permission Check Action

check

Repo Permission Check Action

Check if a user has specific access to this repo

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Repo Permission Check Action

uses: lannonbr/repo-permission-check-action@2.0.2

Learn more about this action in lannonbr/repo-permission-check-action

Choose a version

Repo Permission Check Action

A GitHub action to check if a user has specific access to a repo.

On GitHub, all users have one of four permission levels for any repo:

  • none: no access to a repo
  • read: pull-only access to a repo
  • write: pull and push access to a repo
  • admin: pull, push, and administrator access to a repo.

This action will check on the current repo if the user has a high enough permission level based on a defined argument.

Usage

Say I want to have an action to only pass if a user has write access to the repo, I can use the action as follows:

steps:
  - name: "Check if user has write access"
    uses: "lannonbr/repo-permission-check-action@2.0.0"
    with:
      permission: "write"
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

This will allow anyone with write or higher permissions to succeed.

As this requires access to the GitHub API, the GITHUB_TOKEN secret is required.