Check contexts availability. Some contexts limit where they can be used. For example, jobs.<job_id>.env workflow key does not allow accessing env context, but jobs.<job_id>.steps.env allows. See the official document for the complete list of contexts availability. (#180)
...
env:
TOPLEVEL: ...
jobs:
test:
runs-on: ubuntu-latest
env:
# ERROR: 'env' context is not available here
JOB_LEVEL: ${{ env.TOPLEVEL }}
steps:
- env:
# OK: 'env' context is available here
STEP_LEVEL: ${{ env.TOPLEVEL }}
...
actionlint reports the context is not available and what contexts are available as follows:
test.yaml:11:22: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "secrets", "strategy". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details [expression]
|
11 | JOB_LEVEL: ${{ env.TOPLEVEL }}
| ^~~~~~~~~~~~
Check special functions availability. Some functions limit where they can be used. For example, status functions like success() or failure() are only available in conditions of if:. See the official document for the complete list of special functions availability. (#214)
...
steps:
# ERROR: 'success()' function is not available here
- run: echo 'Success? ${{ success() }}'
# OK: 'success()' function is available here
if: success()
actionlint reports success() is not available and where the function is available as follows:
test.yaml:8:33: calling function "success" is not allowed here. "success" is only available in "jobs.<job_id>.if", "jobs.<job_id>.steps.if". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details [expression]
|
8 | - run: echo 'Success? ${{ success() }}'
| ^~~~~~~~~