Don't set env.ACT in act runner #617

Open
opened 2024-10-23 22:05:43 +00:00 by GammaGames · 1 comment
GammaGames commented 2024-10-23 22:05:43 +00:00 (Migrated from gitea.com)

The documentation for nektos act shows:

Act adds a special environment variable ACT that can be used to skip a step that you don't want to run locally. E.g. a step that posts a Slack message or bumps a version number. You cannot use this method in job level if conditions, see Skipping jobs

- name: Some step
  if: ${{ !env.ACT }}
  run: |
    ...

My workflow always runs the step in gitea actions:

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Hello, Runner!"
        if: ${{ !env.ACT }}
      - run: echo "Hello, Act!"
        if: ${{ env.ACT }}

image.png

Because of this line: 6cdf1e5788/pkg/runner/run_context.go (L85)

The documentation for nektos act shows: > Act adds a special environment variable ACT that can be used to skip a step that you don't want to run locally. E.g. a step that posts a Slack message or bumps a version number. You cannot use this method in job level if conditions, see Skipping jobs > > ```yaml >- name: Some step > if: ${{ !env.ACT }} > run: | > ... > ``` My workflow always runs the step in gitea actions: ```yaml jobs: main: runs-on: ubuntu-latest steps: - run: echo "Hello, Runner!" if: ${{ !env.ACT }} - run: echo "Hello, Act!" if: ${{ env.ACT }} ``` ![image.png](/attachments/ccad18c1-2361-4c73-9fa7-a147a67d2814) Because of this line: https://gitea.com/gitea/act/src/commit/6cdf1e5788dbfa8fe9787a07178c28b64837a61f/pkg/runner/run_context.go#L85
GammaGames commented 2024-10-23 22:11:14 +00:00 (Migrated from gitea.com)

I'm running into this because I'm trying to use act to run my actions locally for testing and only commit working workflows to my repo. Since act and the action runner are based on the same codebase it wasn't hard to track down.

I tried adding the env to my runner.yaml file with no success:

envs:
  ACT: false

And adding it to my runner's .env also had no effect:

ACT=false

Obviously, because act overwrites it no matter what it is

I'm running into this because I'm trying to use act to run my actions locally for testing and only commit working workflows to my repo. Since act and the action runner are based on the same codebase it wasn't hard to track down. I tried adding the env to my `runner.yaml` file with no success: ```yaml envs: ACT: false ``` And adding it to my runner's `.env` also had no effect: ```env ACT=false ``` Obviously, because act overwrites it no matter what it is
Sign in to join this conversation.
No description provided.