[GH-ISSUE #779] github.event.head_commit is missing #488

Open
opened 2026-03-01 21:43:51 +03:00 by kerem · 4 comments
Owner

Originally created by @szmarczak on GitHub (Aug 17, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/779

Originally assigned to: @catthehacker on GitHub.

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
Originally created by @szmarczak on GitHub (Aug 17, 2021). Original GitHub issue: https://github.com/nektos/act/issues/779 Originally assigned to: @catthehacker on GitHub. <!-- - Make sure you are able to reproduce it on the [latest version](https://github.com/nektos/act/releases) - Search the existing issues. - Refer to [README](https://github.com/nektos/act/blob/master/README.md). --> ## System information <!-- - Operating System: < Windows | Linux | macOS | etc... > - Architecture: < x64 (64-bit) | x86 (32-bit) | arm64 (64-bit) | arm (32-bit) | etc... > - Apple M1: < yes | no > - Docker version: < output of `docker system info -f "{{.ServerVersion}}"` > - Docker image used in `act`: < can be omitted if it's included in log > - `act` version: < output of `act --version`, if you've built `act` yourself, please provide commit hash > --> - 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 <!-- - Use `act` with `-v`/`--verbose` and paste output from your terminal in code block below --> <details> <summary>Log (TBD)</summary> ```none PASTE YOUR LOG HERE ``` </details>
Author
Owner

@brunowego commented on GitHub (Aug 23, 2021):

Related to #188

<!-- gh-comment-id:904067926 --> @brunowego commented on GitHub (Aug 23, 2021): Related to #188
Author
Owner

@lermana commented on GitHub (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!

<!-- gh-comment-id:932996375 --> @lermana commented on GitHub (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!
Author
Owner

@lermana commented on GitHub (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
)
<!-- gh-comment-id:932997696 --> @lermana commented on GitHub (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](https://github.com/nektos/act/issues/188#issuecomment-904169001). 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 ) ```
Author
Owner

@ricardo-dematos commented on GitHub (Aug 12, 2022):

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?

<!-- gh-comment-id:1213333406 --> @ricardo-dematos commented on GitHub (Aug 12, 2022): > 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](https://github.com/nektos/act/issues/188#issuecomment-904169001). > > 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 in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#488
No description provided.