Skip to content

Setting the GITHUB_TOKEN explicitly

Sal edited this page Feb 2, 2024 · 5 revisions

Explicit access token injection

Starting with version 1.2.0 users no longer have to provide any GitHub access token to the action. Instead we read the automatically available github.token value from the github context as mentioned here.

However if users still want to provide their own token there are two ways to do so.

1. Use the GITHUB_TOKEN environment variable

This is the old school way of passing your access token. You can use the automatically available ${{ secrets.GITHUB_TOKEN }} secret or provide your own.

- uses: mukunku/[email protected]
  id: check-tag
  with: 
    tag: 'v1'
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2. Use the hidden github_token action parameter

Our action.yml defines an input parameter named github_token that we don't mention in the readme. It's possible to also provide your access token via this parameter.

- uses: mukunku/[email protected]
  id: check-tag
  with: 
    tag: 'v1'
    github_token: ${{ secrets.GITHUB_TOKEN }}

Note: If both options are used the environment variable will take precedence.