action-create-branch
action-create-branch copied to clipboard
Token is never available - ❗ ::error::No token defined in the environment variables
Having tried this a number of ways, including what is written in the readme example, I always get the below error.
❗ ::error::No token defined in the environment variables
- name: Create a new branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: abcde1234abcde1234etcetctec
with:
branch: 'release-notes'
Note the above is running locally, using "nektos/act". I have also tried running this in github itself using the below (which also fails)
- name: Create a new branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'release-notes'
Can you advise?
@devtrop-chrisjolley could be do do with indentation if you are using the yaml exactly as you've written above as yaml is sensitive to indentation. nektos act seems to be about 99% accurate when I've used it :)
I've created a repo showing both v2.0.0
and v2.0.1
working, maybe you can copy from there?
https://github.com/peterjgrainger/test-actions/blob/main/.github/workflows/create-branch.yml https://github.com/peterjgrainger/test-actions/runs/1268416600?check_suite_focus=true
- uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'release-notes'
Thanks Peter - I will check my indentation, but I have had this working fine with:
env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Its when i pass in a PAT directly:
env: GITHUB_TOKEN: somestringforatoken123...
it does not work for me, when trying to run the action locally using act