convictional / trigger-workflow-and-wait

Trigger a workflow in another (or same) repository and wait for the job to finish.
MIT License
311 stars 151 forks source link

Invalid value for input #98

Open brianjmurrell opened 4 months ago

brianjmurrell commented 4 months ago

Hi.

I'm trying to trigger a job with an input defined as:

      functional-test-distros:
        description: 'Distros to run Functional testing on (i.e. el8, el8, leap15, etc.)'
        required: false

and trying to pass a JSON array as the value. For example: ["el8","el9","leap15"].

Doing this works fine when I run the workflow manually from the GitHub Actions UI.

When I try to pass that JSON string as an input from trigger-workflow-and-wait I get an error. Here is the output from the entire trigger-workflow-and-wait step:

Run convictional/trigger-workflow-and-wait@v1.6.5
/usr/bin/docker run --name d721bd2654f1f8c633608c4af3303_bf7aea --label 242307 --workdir /github/workspace --rm -e "EL8_BUILD_VERSION" -e "EL9_BUILD_VERSION" -e "LEAP15_VERSION" -e "DISTROS" -e "TEST_TAG" -e "INPUT_OWNER" -e "INPUT_REPO" -e "INPUT_GITHUB_TOKEN" -e "INPUT_COMMENT_DOWNSTREAM_URL" -e "INPUT_WORKFLOW_FILE_NAME" -e "INPUT_REF" -e "INPUT_WAIT_INTERVAL" -e "INPUT_CLIENT_PAYLOAD" -e "INPUT_PROPAGATE_FAILURE" -e "INPUT_GITHUB_USER" -e "INPUT_TRIGGER_WORKFLOW" -e "INPUT_WAIT_WORKFLOW" -e "INPUT_COMMENT_GITHUB_TOKEN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/jenkins/gha_runners/actions-runner1/_work/_temp/_github_home":"/github/home" -v "/jenkins/gha_runners/actions-runner1/_work/_temp/_github_workflow":"/github/workflow" -v "/jenkins/gha_runners/actions-runner1/_work/_temp/_runner_file_commands":"/github/file_commands" -v "/jenkins/gha_runners/actions-runner1/_work/argobots/argobots":"/github/workspace" 242307:422d721bd2654f1f8c633608c4af3303
Getting workflow runs using query: event=workflow_dispatch&created=>=2024-04-23T22:09:36+00:00&actor=&per_page=100
Triggering workflow:
  workflows/rpm-build-and-test.yml/dispatches
  {"ref":"bmurrell/run-on-dispatch","inputs":{"pr-repos":"argobots@PR-23","commit-message":"Override commit pragmas","test-tag":"load_mpi test_core_files always_passes,vm","rpm-test-version":"2.5.101","functional-test-distros":["el8","el9","leap15"]}}
curl: (22) The requested URL returned error: 422
api failed:
path: workflows/rpm-build-and-test.yml/dispatches
response: {
  "message": "Invalid value for input 'functional-test-distros'",
  "documentation_url": "https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event"
}

The JSON string is valid:

$ echo '{"ref":"bmurrell/run-on-dispatch","inputs":{"pr-repos":"argobots@PR-23","commit-message":"Override commit pragmas","test-tag":"load_mpi test_core_files always_passes,vm","rpm-test-version":"2.5.101","functional-test-distros":["el8","el9","leap15"]}}' | json_pp
{
   "inputs" : {
      "commit-message" : "Override commit pragmas",
      "functional-test-distros" : [
         "el8",
         "el9",
         "leap15"
      ],
      "pr-repos" : "argobots@PR-23",
      "rpm-test-version" : "2.5.101",
      "test-tag" : "load_mpi test_core_files always_passes,vm"
   },
   "ref" : "bmurrell/run-on-dispatch"
}

So while I can appreciate that this action is just passing along an error from the API, do you have any further thoughts on why this works when run interactively from GitHub Actions UI but not via the API?