actions / languageservices

Language services for GitHub Actions workflows and expressions.
MIT License
67 stars 23 forks source link

`Context access might be invalid` warning shows for `push`, not for `pull_request` event #97

Open garysassano opened 1 month ago

garysassano commented 1 month ago

Describe the bug See screenshots below.

To Reproduce Steps to reproduce the behavior:

  1. With this workflow '...'
  2. Do this '...'
  3. See error

Expected behavior Context access might be invalid shows up for all kind of events where the context might be missing.

Screenshots image image

Package/Area

Package Version v1.x.y

Additional context Add any other context about the problem here.

garysassano commented 1 month ago

Apparently, you access the head_commit property without specifying an event type (github.event.head_commit.messag), even though the structure of the payload should be correct according to the docs.

Also, technically the Context access might be invalid warning should always be displayed when accessing any event-specific context, since you have no guarantee of which event type triggered the workflow UNLESS the workflow specifies a single trigger, in which case that event type context would be guaranteed to be valid.