Skip to main content

GitHub Configuration

Creating an Access Token in GitHub

Supported GitHub Authentication

You can use either classic personal access tokens or fine-grained personal access tokens. For more information on the differences between these token types, refer to the GitHub Docs.

Basic authentication (username and password) is not supported. This method is less secure and GitHub has deprecated its use for authenticating Git operations since August 13, 2021.

Required Permissions for Tokens (classic)

See this explanation for details of GitHub scopes.

The items above are classic PAT scopes (coarse-grained). Fine-grained PATs use permissions instead (for example pull_requests=write).

Required Permissions for Fine-Grained Tokens

Fine-grained personal access tokens (PATs) are configured with:

  • Repository access: All repositories or only select repositories (a subset).

  • Repository permissions: What the token can do in those repos (see table below).

GitHub’s REST API surfaces the technical permission strings for fine-grained permissions via the X-Accepted-GitHub-Permissions response header (examples include pull_requests=write and contents=read). The permission-string mappings below match GitHub’s published list for fine-grained PAT permissions.

Repository Permissions

Repository Permissions

Access Levels

Permission String

Administration

Read-only

administration=read

Commit statuses

Read and write

statuses=write

Contents

Read and write

contents=write

Deployments

Read-only

deployments=read

Metadata

Read-only

metadata=read

Pull requests

Read and write

pull_requests=write

How to Create the Access Token

  1. Log in to GitHub.

  2. In the upper-right corner, click your avatar and select Settings.

  3. In the left menu, click Developer Settings.

  4. In the left menu, select Fine-grained tokens or Tokens (classic).

  5. Click the Generate new token button.

  6. Select Generate new token for fine-grained, repo-scoped tokens, or Generate new token (classic) for general use.

  7. Save your PAT. You will not be able to view this token again.

Protecting the Target Branch in GitHub

You can prevent users from merging Pull Requests with failing IQ Policy Evaluations with a Branch Protection Rule. IQ Policy Evaluations must be set to Fail at the Source Stage.

To protect a branch:

  1. Select a Repository.

  2. Click Settings.

  3. Select Branches from the sidebar.

  4. Click Add rule or edit an existing rule.

  5. Check to Require status checks to pass before merging.

  6. Check IQ Policy Evaluation.

  7. Save Changes

126654802.png

Note

The IQ Policy Evaluation status check will not appear in the list of status checks found in the last week for this repository until the first policy evaluation status has been added to the repository.

126654803.png