taiki-e / create-gh-release-action

GitHub Action for creating GitHub Releases based on changelog.
Apache License 2.0
72 stars 11 forks source link

"GITHUB_TOKEN not set" error when running with act #14

Closed kirrg001 closed 2 years ago

kirrg001 commented 2 years ago

Hi there!

I am using act to test the GH action locally.

act push -e eventpath.json -s GH_PAT=TEST

release.yml

name: create-gh-release

permissions:
  contents: write

on:
  push:
    tags:
      - v[0-9]+.*      

jobs:
  create-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          token: ${{ secrets.GH_PAT }}
      - uses: taiki-e/create-gh-release-action@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GH_PAT }}
        with:
          changelog: CHANGELOG.md
          draft: true

I am getting an error

❗ ::error::GITHUB_TOKEN not set

I am unable to use a custom secret variable name for my token and pass it into taiki-e/create-gh-release-action@v1.

Any idea?

Thanks :)

taiki-e commented 2 years ago

maybe related: https://github.com/nektos/act/issues/610

kirrg001 commented 2 years ago

When I enable debug logs, I can see that the secret is there.

[create-gh-release/create-release] [DEBUG] expression '${{ secrets.GH_PAT }}' rewritten to 'format('{0}', secrets.GH_PAT)' [create-gh-release/create-release] [DEBUG] evaluating expression 'format('{0}', secrets.GH_PAT)' [create-gh-release/create-release] [DEBUG] expression 'format('{0}', secrets.GH_PAT)' evaluated to '%!t(string=LOLOLOL)'

I am wondering why e.g. https://github.com/actions/checkout is using token: and not GITHUB_TOKEN:.

taiki-e commented 2 years ago

I would accept a patch to add a tokon: input option for environments that cannot handle env: correctly, but there is no motivation on our part to do this since non-GHA environments are not officially supported.