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

github.event.head_commit is missing #779

Open
szmarczak opened this issue Aug 17, 2021 · 4 comments
Open

github.event.head_commit is missing #779

szmarczak opened this issue Aug 17, 2021 · 4 comments
Assignees
Labels
area/workflow Relating to workflow definitions kind/bug Something isn't working stale-exempt Exempt from stale

Comments

@szmarczak
Copy link

System information

  • Operating System: Linux
  • Architecture: x64
  • Apple M1: no
  • Docker version: Docker version 20.10.7-ce, build 363e9a88a11be517d9e8c65c998ff56f774eb4dc
  • Docker image used in act:
  • act version: act version 0.2.24

Expected behaviour

Should execute next steps.

Actual behaviour

ERRO[0000] Unable to interpolate string '${{ !contains(github.event.head_commit.message, '[skip ci]') }}' - [TypeError: Cannot access member 'message' of undefined]

Workflow and/or repository

https://github.com/apify/apify-js

act -j build_and_test

Steps to reproduce

  1. Clone https://github.com/apify/apify-js
  2. act -j build_and_test

act output

Log (TBD)
PASTE YOUR LOG HERE
@szmarczak szmarczak added the kind/bug Something isn't working label Aug 17, 2021
@catthehacker catthehacker linked a pull request Aug 17, 2021 that will close this issue
@catthehacker catthehacker self-assigned this Aug 17, 2021
@catthehacker catthehacker added this to Needs triage in Bug squashing via automation Aug 17, 2021
@catthehacker catthehacker added area/workflow Relating to workflow definitions stale-exempt Exempt from stale labels Aug 17, 2021
@catthehacker catthehacker moved this from Needs triage to Work in progress in Bug squashing Aug 17, 2021
@brunowego
Copy link

Related to #188

@lermana
Copy link

lermana commented Oct 3, 2021

I can confirm this is happening to me as well, by the way. For instance, I can define the following just fine:

if: startsWith(github.ref, 'ref')

However, this errors out:

if: startsWith(github.event.head_commit.message, 'build')

Here's some of the output when run with -v:

DEBU[0000] Evaluating 'Boolean(startsWith(github['event']['head_commit']['message'], 'build'))' instead of 'Boolean(startsWith(github.event.head_commit.message, 'build'))' 

Thank you for act, by the way -- it's a great tool!

@lermana
Copy link

lermana commented Oct 3, 2021

I want to follow up that a different thread provided a workaround (thanks @brunowego for linking!). The issue here is that act runs off an empty event JSON, so you've got to provide your own if you want to access that data. You can see a working example (plus the rest of the conversation that led to it), here.

Here's what I ran to allow for testing if on a commit message:

act -W components.yaml -s GITHUB_TOKEN=$GITHUB_TOKEN  -e <(cat << EOF
{
    "head_commit": {
      "message": "build latest"
    }
  }
EOF
)

@ricardo-dematos
Copy link

I want to follow up that a different thread provided a workaround (thanks @brunowego for linking!). The issue here is that act runs off an empty event JSON, so you've got to provide your own if you want to access that data. You can see a working example (plus the rest of the conversation that led to it), here.

Here's what I ran to allow for testing if on a commit message:

act -W components.yaml -s GITHUB_TOKEN=$GITHUB_TOKEN  -e <(cat << EOF
{
    "head_commit": {
      "message": "build latest"
    }
  }
EOF
)

This is how I'm working around the missing field, but since act populates the github.sha, surely it can also populate the head_commit field. Right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/workflow Relating to workflow definitions kind/bug Something isn't working stale-exempt Exempt from stale
Projects
Bug squashing
  
Work in progress
Development

Successfully merging a pull request may close this issue.

5 participants