Skip to content

Error running locally using act: ACTION_TOKEN variable not set #110

Open
@LukeSavefrogs

Description

@LukeSavefrogs

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

g105b commented on Sep 29, 2023

@g105b
Member

Are you running this on Github or a self-hosted runner?

LukeSavefrogs

LukeSavefrogs commented on Sep 29, 2023

@LukeSavefrogs
Author

Are you running this on Github or a self-hosted runner?

I'm using act to test the action locally

g105b

g105b commented on Sep 30, 2023

@g105b
Member

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

LukeSavefrogs commented on Sep 30, 2023

@LukeSavefrogs
Author

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.

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)

changed the title [-]Error: ACTION_TOKEN variable not set[/-] [+]Error running using act: ACTION_TOKEN variable not set[/+] on Oct 1, 2023
changed the title [-]Error running using act: ACTION_TOKEN variable not set[/-] [+]Error running locally using act: ACTION_TOKEN variable not set[/+] on Oct 1, 2023
SierraKomodo

SierraKomodo commented on Oct 4, 2023

@SierraKomodo

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 my gh 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:

g105b

g105b commented on Oct 5, 2023

@g105b
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @g105b@SierraKomodo@LukeSavefrogs

        Issue actions

          Error running locally using act: ACTION_TOKEN variable not set · Issue #110 · php-actions/composer