Skip to content

GitHub Action to check if an actor has a specific access to the repository

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
COPYING
Notifications You must be signed in to change notification settings

prince-chrismc/check-actor-permissions-action

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

Repository files navigation

Check Actor Permissions Action

MIT codecov

Purpose

A GitHub Action to check if the current actor has sufficient access to the repository.

Actors may have one of four permission levels for any repository:

  • none: no access
  • read: pull-only access
  • write: pull and push access
  • admin: pull, push, and administrator access

This action will check the current repository to see if the actor has a high enough permission level based on the provided argument.

Getting Started

To have an action that only passes if the actor has write access to the repo, use the action as follows:

steps:
  - name: Enforce permission requirement
    uses: prince-chrismc/check-actor-permissions-action@v3
    with:
      permission: write

Conditionally Continue

To have the workflow change behaviors depending on the actor's permissions, use the action as follows:

steps:
  - id: check
    continue-on-error: true
    uses: prince-chrismc/check-actor-permissions-action@v3
    with:
      github_token: ${{ github.token }}
      permission: write
  - if: steps.check.outputs.permitted == 'true'
    uses: actions/checkout@v3
    with:
      token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # Typically this would fail on public forks as secret are not available

About

GitHub Action to check if an actor has a specific access to the repository

Topics

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
COPYING

Stars

Watchers

Forks

Sponsor this project