mathieudutour / github-tag-action

A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on any platform.
https://github.com/marketplace/actions/github-tag
MIT License
641 stars 201 forks source link

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

Open pickaxe828 opened 1 year ago

pickaxe828 commented 1 year ago

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/github-tag-action@v6.1
  with:
    github_token: ${{ inputs.github_token }}

Output:

Run mathieudutour/github-tag-action@v6.1
    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/github-tag-action@v6.1
with:
  github_token: ${{ inputs.github_token }}
hemant-kr-meena commented 1 year ago

you can use this example

- name: Bump version and push tag
  id: tag_version
  uses: mathieudutour/github-tag-action@v6.1
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
yp28 commented 1 year ago

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/github-tag-action@v6.1
        with:
          github_token: ${{ secrets.PAT }}
          fetch_all_tags: true
          release_branches: main

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

yp28 commented 1 year ago

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.

kivra-pauoli commented 1 month ago

Slightly related: there's a dry_run option, but the action still requires a github_token. Is this by design (because the description only mentions "Required for permission to tag the repo.")? If the repository is already checked out can't the next tag be calculated without requiring the token? Thanks.