I am trying to create my first github actions and run them locally, initially.
Whenever I try to run an action that involves interacting with the repo, eg checkout or try to create a branch, I get errors saying that there is no token set.
I am using nektos/act to run and debug my actions locally on a MacBook Pro. I have generated a Personal Access Token in github, and I have set env: GITHUB_TOKEN to the token in my yml code.
I understand that I can specify the token like this, when i am running the action within github itself:
- name: SomeStep
id: some-step
uses: peterjgrainger/action-create-branch@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'new-branch-name'
The above also does not seem to work currently, but I suspect that I have an issue elsewhere in my action.
To get to the bottom of that, I want to work on it locally - where the above secrets.GITHUB_TOKEN does not work. Neither does setting the token to the one I generated.
eg:
- name: SomeStep
id: some-step
uses: peterjgrainger/action-create-branch@v1.0.0
env:
GITHUB_TOKEN: abcde12345abc12345mypersonalaccesstokenhere
with:
branch: 'new-branch-name'
What might I be doing wrong?