Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check

GitHub Action

Check Actor Permissions

v2.0.0

Check Actor Permissions

check

Check Actor Permissions

Check if an actor has a specific access to the repository

Installation

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

              

- name: Check Actor Permissions

uses: prince-chrismc/check-actor-permissions-action@v2.0.0

Learn more about this action in prince-chrismc/check-actor-permissions-action

Choose a version

Check Actor Permissions Action

MIT codecov

Purpose

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

Actors may 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 against the current repository 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@v1
    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@v1
    with:
      github_token: ${{ github.token }}
      permission: write
  - if: steps.check.outputs.permitted == 'true'
    uses: actions/checkout@v2
    with:
      token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # Typically this would fail on public forks as secret at not available