vscode-github-actions icon indicating copy to clipboard operation
vscode-github-actions copied to clipboard

`Required property is missing: shell`

Open garysassano opened this issue 1 year ago • 7 comments

Describe the bug

The VS Code extension lacks critical linting support. Specifically, when creating a Composite Action, it fails to provide a warning that a shell property is required. I only became aware of this after pushing an update and encountering the following error:

.github/actions/aws-config/action.yml (Line: 18, Col: 7): Required property is missing: shell

Expected behavior The VS Code extension should display a warning when authoring a Composite Action for each step that meets the following conditions:

  • run property is used
  • shell property is not specified

Extension Version v0.26.3

garysassano avatar Aug 20 '24 19:08 garysassano

Background info:

runs.steps[*].shell

Optional The shell where you want to run the command. You can use any of the shells listed in "Workflow syntax for GitHub Actions." Required if run is set.

Update: So according to the doc for runs for composite actions, runs.steps[*].shell is required if runs.steps[*].shell is set in the same step, otherwise optional.

muzimuzhi avatar Aug 20 '24 20:08 muzimuzhi

Background info:

runs.steps[*].shell Optional The shell where you want to run the command. You can use any of the shells listed in "Workflow syntax for GitHub Actions." Required if run is set.

THIS is the correct docs you should reference to. The shell property is REQUIRED for Composite Actions.

garysassano avatar Aug 20 '24 20:08 garysassano

@garysassano You might overlooked the last sentence in my quote: "Required if run is set."

muzimuzhi avatar Aug 20 '24 20:08 muzimuzhi

@muzimuzhi I still don't see how your message solves the issue? If you are inside a Composite Action and you create a step with run property but without shell property, the VS Code extension doesn't warn you about it.

garysassano avatar Aug 20 '24 20:08 garysassano

I still don't see how your message solves the issue?

It doesn't. I just quoted the relevant doc which supports what you reported and perhaps gives more detailed info about when shell is required.

muzimuzhi avatar Aug 20 '24 20:08 muzimuzhi

@garysassano As a workaround, you can try extension redhat.vscode-yaml which uses schemas from https://www.schemastore.org/json/ to validate both workflows and composite actions.

It's default setting is already capable at catching the missing property shell error: image The action in screenshot above is .github/actions/unique-id/action.yml in muzimuzhi/hello-github-actions repo.

PS: redhat.vscode-yaml extension is also used to work around #75, see https://github.com/github/vscode-github-actions/issues/75#issuecomment-1490722860 and https://github.com/github/vscode-github-actions/issues/75#issuecomment-1736463114.

muzimuzhi avatar Aug 20 '24 21:08 muzimuzhi

I had to uninstall that extension since it was giving me issues with CloudFormation and other stuff.

garysassano avatar Aug 21 '24 00:08 garysassano