github / vscode-github-actions

GitHub Actions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions
MIT License
476 stars 72 forks source link

Missing values error for provided values #264

Closed Vino4 closed 10 months ago

Vino4 commented 10 months ago

Describe the bug Some required values are highlighted with "Missing" error despite being provided

To Reproduce Steps to reproduce the behavior:

  1. With the easingthemes/ssh-deploy workflow version 4.1.8 (latest)
  2. Fill in the required values:
      - name: Push Over SSH
        if: steps.checkTag.outputs.exists == 'false'
        uses: easingthemes/ssh-deploy@main
        env:
            SOURCE: "/api"
            SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
            ARGS: "-rlgoDzvc -i --delete"
            REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
            REMOTE_USER: ${{ secrets.REMOTE_USER }}
            TARGET: ${{ secrets.REMOTE_TARGET }}
            SCRIPT_BEFORE: |
              echo "[Running Pre-Rsync Script]"
              ...
            SCRIPT_AFTER: |
              echo "[Running Post-Rsync Script]"
              ...
  3. See error:

    Missing required inputs: SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER

Expected behavior No error should appear

Screenshots

image

Extension Version v0.26.2

muzimuzhi commented 10 months ago

With uses: easingthemes/ssh-deploy@main the extension reads the corresponding action.yml and finds if all the required inputs are provided with jobs.<job_id>.steps[*].with.

Since the corresponding action.yml marks those input all required,

inputs:
  SSH_PRIVATE_KEY:
    description: "Private key part of an SSH key pair"
    required: true
  REMOTE_HOST:
    description: "Remote host"
    required: true
  REMOTE_USER:
    description: "Remote user"
    required: true
   # more inputs

error

Missing required inputs: SSH_PRIVATE_KEY, REMOTE_HOST, REMOTE_USER

was thrown.

But action easingthemes/ssh-deploy is special. Use one of the three inputs SSH_PRIVATE_KEY as an example:

- uses: easingthemes/ssh-deploy@main
  with:
    SSH_PRIVATE_KEY: some_value

According to the documentation for jobs.<job_id>.steps[*].with, GitHub Action will convert this input to an environment variable INPUT_SSH_PRIVATE_KEY, then the action to-be-used is expected to read the value of input SSH_PRIVATE_KEY through that environment variable. But easingthemes/ssh-deploy can also read from environment variable SSH_PRIVATE_KEY, without the prefix INPUT_, see its related code.

To some extent, I doubt if those three inputs are still required (for jobs.<job_id>.steps[*].with). But if GitHub Action tolerates this ...

Vino4 commented 10 months ago

Ahhh! It's not actually a bug then :) Thanks for looking into this @muzimuzhi 😁🙇‍♂️