rhysd / actionlint

:octocat: Static checker for GitHub Actions workflow files
https://rhysd.github.io/actionlint/
MIT License
2.49k stars 149 forks source link

runner property "environment" is not defined in object type #412

Closed acalcutt closed 1 month ago

acalcutt commented 1 month ago

I am trying to use runner.environment in my workflow, which works. However actionlint gives me the following error

.github/workflows/node-ci.yml:168:13: property "environment" is not defined in object type {arch: string; debug: string; name: string; os: string; temp: string; tool_cache: string} [expression]
    |
168 |         if: runner.environment == 'github-hosted'

Researching the reason why I notice running.environment has not yet been documented. https://github.com/orgs/community/discussions/118413 https://github.com/github/docs/issues/32443 so I am wondering if that is related

rhysd commented 1 month ago

That's because it is undocumented. Once we understand it is a part of public API, we can easily add it to actionlint.

Previously there were several private context properties and such properties were removed silently. So undocumented properties are basically not recognized by actionlint.

https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context

rhysd commented 1 month ago

According to https://github.com/github/docs/issues/32443, it seems a public API. So I will add the property.

acalcutt commented 1 month ago

Thanks for including this!