Skip to content

Commit d936cb4

Browse files
committed
update doc for strict context availability check
1 parent b96989f commit d936cb4

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

docs/checks.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,6 +2642,12 @@ jobs:
26422642
env:
26432643
# ERROR: 'env' context is not available here
26442644
NAME: ${{ env.NAME }}
2645+
services:
2646+
redis:
2647+
image: redis
2648+
env:
2649+
# ERROR: No context is allowed here
2650+
COMMIT_SHA: ${{ github.sha }}
26452651
steps:
26462652
- env:
26472653
# OK: 'env' context is available here
@@ -2663,13 +2669,17 @@ test.yaml:18:17: context "env" is not allowed here. available contexts are "gith
26632669
|
26642670
18 | NAME: ${{ env.NAME }}
26652671
| ^~~~~~~~
2666-
test.yaml:24: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]
2672+
test.yaml:24:27: context "github" is not allowed here. no context is available here. see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details [expression]
2673+
|
2674+
24 | COMMIT_SHA: ${{ github.sha }}
2675+
| ^~~~~~~~~~
2676+
test.yaml:30: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]
26672677
|
2668-
24 | run: echo 'Success? ${{ success() }}'
2678+
30 | run: echo 'Success? ${{ success() }}'
26692679
| ^~~~~~~~~
26702680
```
26712681

2672-
[Playground](https://rhysd.github.io/actionlint/#eNp8jj1OwzAYhnef4h2QCkNyAC+IgREWTpCkXxtDa0ffT0tU+e7ITU2QkOrFev/sJ0WPyWR0juLJO+D95e3Vg8dZts59pl6KqSRabkCUO6X9vCjg2CmH76qAbWAaNPG8WkCDh8sF+6Cj9e058dfukM7I+V+FLUbiVuk41ZgtSlMorbeo1hy6AnONbsTlLNTlCYqntqi6F6VJaq35u7m/u/3tQcOYsPmwYSCR52tXFvH4hJw3v+2w82vyEwAA//9WsV7P)
2682+
[Playground](https://rhysd.github.io/actionlint/#eNp0j8FOwzAMhu99Ch+QBof2AXJBE0KCQ+Ew7ihNvSawJpXtdFRT3x1lXdsJNF+i/7f953PwCrrINsvQ9yoDeNuWzwrIDlxn2VeoOJmCLOkFYCEt2AyTAmi1kPuZFUDtCI0EGlYLIIe70wkaJzZWxTHQ9/4QjjCO/0Yoeo9UCLbd3KboOU+UsYpeYn7QCebcuhCnmqhTBPq+SGreZ6TeGeR5krB2vMK5VjeoJncxr4JTPb2X5evH5+5lq64PYauXTwS7JTT/u38b7nKgAjQ2wGYXjUHmx/MsT+L+AcZxs/Lu1dr5DQAA//+iDXkG)
26732683

26742684
Some contexts are only available in some places. For example, `env` context is not available at `jobs.<job_id>.env`, but it is
26752685
available at `jobs.<job_id>.steps.env`.
@@ -2958,7 +2968,7 @@ Note that `steps` in Composite action's metadata is not checked at this point. I
29582968
[reusable-workflow-outputs]: https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-outputs-from-a-reusable-workflow
29592969
[inherit-secrets-announce]: https://github.blog/changelog/2022-05-03-github-actions-simplify-using-secrets-with-reusable-workflows/
29602970
[specific-paths-doc]: https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#using-filters-to-target-specific-paths-for-pull-request-or-push-events
2961-
[availability-doc]: https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
2971+
[availability-doc]: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#context-availability
29622972
[deprecate-set-output-save-state]: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
29632973
[deprecate-set-env-add-path]: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
29642974
[workflow-commands-doc]: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

0 commit comments

Comments
 (0)