Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to determine whether running workflows with act? #422

Closed
theowenyoung opened this issue Nov 16, 2020 · 5 comments
Closed

How to determine whether running workflows with act? #422

theowenyoung opened this issue Nov 16, 2020 · 5 comments
Labels

Comments

@theowenyoung
Copy link
Contributor

theowenyoung commented Nov 16, 2020

Hi,

I can check if a workflow running in Github Actions by ${{ env.GITHUB_ACTIONS=='true'}}, but act also define env GITHUB_ACTIONS: true, so how to determine whether running workflows with act?

There are some steps that I only want to run with Github, not locally.

Example:

name: Build Site
on:
  workflow_dispatch:
  push:
jobs:
  run:
    runs-on: ubuntu-latest
    name: Run
    steps:
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3
        if: env.GITHUB_ACTION=='true'
        with:
          token: ${{ secrets.PERSONAL_TOKEN }}

How to define if condition?

@austinsasko
Copy link

I think this is something that can have an env var for act specifically. e.g. in the runner context code I can add a line for
env["ACT_LOCAL"] = "true" and some other code where needed (e.g. dist index.js in repo)

Then in the job you can specify
if: env.ACT_LOCAL=='true' and have that job only execute when running from act on your local machine

Would this provide you the functionality you are looking for?

@theowenyoung
Copy link
Contributor Author

@austinsasko yes, that totally solves my problem..

@torbjornvatn
Copy link
Contributor

This is actually solved in #417 which was merged to master yesterday.
It introduces an ACT=true environment variable

@MattKiazyk
Copy link

@torbjornvatn when can we expect a release that has #417 in it?

@github-actions
Copy link
Contributor

Issue is stale and will be closed in 14 days unless there is new activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants