github-tag-action icon indicating copy to clipboard operation
github-tag-action copied to clipboard

How to fix `Parameter token or opts.auth is required`

Open pickaxe828 opened this issue 2 years ago • 4 comments

Expected:

No error

What's actually happening:

The original action Part of the associated .yml:

- name: Bump version and push tag
  id: tag_version
  uses: mathieudutour/[email protected]
  with:
    github_token: ${{ inputs.github_token }}

Output:

Run mathieudutour/[email protected]
    default_bump: patch
    default_prerelease_bump: prerelease
    tag_prefix: v
    release_branches: master,main
    create_annotated_tag: false
    fetch_all_tags: false
    dry_run: false
Error: Parameter token or opts.auth is required

And stopped running.

So what is token actually? I've tried adding the GitHub token to it

uses: mathieudutour/[email protected]
with:
  github_token: ${{ inputs.github_token }}

pickaxe828 avatar Feb 03 '23 13:02 pickaxe828

  • you should use ${{ secrets.GITHUB_TOKEN }} instead of ${{ inputs.github_token }}
  • there is no variable exists like ${{ inputs.github_token }} in workflows environment.

you can use this example

- name: Bump version and push tag
  id: tag_version
  uses: mathieudutour/[email protected]
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
  • hope this will help you.

hemant-kr-meena avatar Mar 09 '23 14:03 hemant-kr-meena

I am hitting this issue as well, using a personal access token. It previously worked with the exact same configuration. My code is as follows:

name: on-push-main
on:
  push:
    branches:
      - main

jobs:
  tagging:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: mathieudutour/[email protected]
        with:
          github_token: ${{ secrets.PAT }}
          fetch_all_tags: true
          release_branches: main

Nothing relevant changed, and the access token is not expired.

yp28 avatar Jun 12 '23 07:06 yp28

Diving just slightly deeper I found out this happened when the on-push-main workflow was triggered by dependabot[bot] rather than an actual user. Something weird happens that causes the error to occur.

It's a non-issue for me, since this shouldn't happen in my workflows, usually. Upon pushing from an actual user the action worked correctly.

yp28 avatar Jun 12 '23 07:06 yp28