Skip to content

GitHub Action to check if a user has specific access to a repo

License

Notifications You must be signed in to change notification settings

lannonbr/repo-permission-check-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

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

GitHub Action to check if a user has specific access to a repo

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •