Open
Description
Running the following causes the workflow to fail with the error in the subject:
- name: Install composer dependencies
uses: php-actions/composer@v6
with:
php_version: '8.2'
args: --no-dev --no-interaction --prefer-dist --optimize-autoloader
I tried adding ACTION_TOKEN
as an env variable but it still doesn't work:
- name: Install composer dependencies
uses: php-actions/composer@v6
with:
php_version: '8.2'
args: --no-dev --no-interaction --prefer-dist --optimize-autoloader
env:
ACTION_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The action does NOT work even removing all optional parameters:
- name: Install composer dependencies
uses: php-actions/composer@v6
Activity
g105b commentedon Sep 29, 2023
Are you running this on Github or a self-hosted runner?
LukeSavefrogs commentedon Sep 29, 2023
I'm using
act
to test the action locallyg105b commentedon Sep 30, 2023
Ok thank you. It would be super useful to use act, so I'll try and replicate and figure out a fix, but I've never had much luck with act - it "feels" like GitHub actions, but it isn't really running anything official and there are lots of gaps, in my experience.
LukeSavefrogs commentedon Sep 30, 2023
Thank you for your patience @g105b.
Until now I've found
act
very useful in most of the cases to test actions locally before deploying. Only times I couldn't use it is for Windows/macOs runners (which do not support natively and i didn't have the time to find how to configure properly) or very rarely with some actions (as in this case)[-]Error: ACTION_TOKEN variable not set[/-][+]Error running using act: ACTION_TOKEN variable not set[/+][-]Error running using act: ACTION_TOKEN variable not set[/-][+]Error running locally using act: ACTION_TOKEN variable not set[/+]SierraKomodo commentedon Oct 4, 2023
After some digging and research on my end, I've found a solution - It's essentially an extra step needed in running act with this, or any other action that needs an ACTION_TOKEN.
Some relevant links:
I have act installed as a github cli extension, so the solution for me was to simply add
-s GITHUB_TOKEN="$(gh auth token)"
as an argument to mygh act
call, and that resolved the ACTION_TOKEN error.If you don't use it as a github cli extension, it looks like you can also resolve this by:
GITHUB_TOKEN=your-token-here
to the above secrets file--secret-file path-to-secrets-file
g105b commentedon Oct 5, 2023
Thank you so much @SierraKomodo. I hadn't used ACT personally, so this will really help me get going, and once I've learnt how to use it I'll add some documentation to this repo for future ACT users.