How to fix `Parameter token or opts.auth is required`
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 }}
- 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.
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.
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.