actions / runner

The Runner for GitHub Actions :rocket:
https://github.com/features/actions
MIT License
4.65k stars 895 forks source link

Runner throwing System.ArgumentException (found BasicExpressionToken not MappingToken) #3301

Closed gregschmit closed 1 month ago

gregschmit commented 1 month ago

Describe the bug

Runner is erroring out parsing an action that parsed perfectly fine yesterday:

To Reproduce Steps to reproduce the behavior:

  1. Go to: Successful job from last night: https://github.com/gregschmit/rails-rest-framework/actions/runs/9167963220/job/25205991478
  2. Go to: Failing job from today (just re-ran the above deploy job): https://github.com/gregschmit/rails-rest-framework/actions/runs/9167963220/job/25236841960
  3. See that the same job that passed last night failed today.

Expected behavior The job that passed last night should pass today.

Runner Version and Platform

Current runner version: '2.316.1' Ubuntu 22.04.4 LTS

What's not working?

##[debug]action.yml for action: '/home/runner/work/_actions/snok/container-retention-policy/v2/action.yml'.
Error: System.ArgumentException: Unexpected type 'BasicExpressionToken' encountered while reading 'env'. The type 'MappingToken' was expected.
   at GitHub.DistributedTask.ObjectTemplating.Tokens.TemplateTokenExtensions.AssertMapping(TemplateToken value, String objectDescription)
   at GitHub.Runner.Worker.ActionManifestManager.ConvertRuns(IExecutionContext executionContext, TemplateContext templateContext, TemplateToken inputsToken, String fileRelativePath, MappingToken outputs)
   at GitHub.Runner.Worker.ActionManifestManager.Load(IExecutionContext executionContext, String manifestFile)
Error: Failed to load snok/container-retention-policy/v2/action.yaml
##[debug]System.ArgumentException: Failed to load snok/container-retention-policy/v2/action.yaml

Also, at the same time my VSCode also displays the step as invalid (no code changed since last night): image

gregschmit commented 1 month ago

The part of the YAML file that it is referring to looks like this (https://github.com/snok/container-retention-policy/blob/main/action.yml):

...
          "$TOKEN_TYPE"
      env:
          ACCOUNT_TYPE: "${{ inputs.account-type }}"
          ORG_NAME: "${{ inputs.org-name }}"
...

But that env key seems to have a mapping under it, not a "BasicExpressionToken". It uses 4-space indents, but that shouldn't be a problem (and wasn't last night).

gregschmit commented 1 month ago

Resolved: https://github.com/orgs/community/discussions/125059#discussioncomment-9512231