Add handling for additional workflow dispatch errors
This commit is contained in:
Vendored
+5
-1
@@ -647,8 +647,12 @@ function run() {
|
||||
catch (error) {
|
||||
core.debug(util_1.inspect(error));
|
||||
const message = error.message;
|
||||
// Handle validation errors from workflow dispatch
|
||||
if (message == 'Unexpected inputs provided' ||
|
||||
(message.startsWith('Required input') && message.endsWith('not provided'))) {
|
||||
(message.startsWith('Required input') &&
|
||||
message.endsWith('not provided')) ||
|
||||
message.startsWith('No ref found for:') ||
|
||||
message == `Workflow does not have 'workflow_dispatch' trigger`) {
|
||||
core.setOutput('error-message', message);
|
||||
core.warning(message);
|
||||
}
|
||||
|
||||
@@ -97,6 +97,8 @@ When creating the [workflow_dispatch](https://docs.github.com/en/actions/referen
|
||||
|
||||
- `Required input '...' not provided` - A required input for the workflow was not supplied as a named argument.
|
||||
- `Unexpected inputs provided` - Named arguments were supplied that are not defined as workflow inputs.
|
||||
- `No ref found for: ...` - The supplied `ref` does not exist in the target repository.
|
||||
- `Workflow does not have 'workflow_dispatch' trigger` - The target workflow doesn't define `on: workflow_dispatch`, OR, the supplied `ref` doesn't contain the target workflow.
|
||||
|
||||
The `error-message` output can be used to provide feedback to the user as follows. Note that the action step needs an `id` to access outputs.
|
||||
|
||||
|
||||
+5
-1
@@ -192,9 +192,13 @@ async function run(): Promise<void> {
|
||||
} catch (error) {
|
||||
core.debug(inspect(error))
|
||||
const message: string = error.message
|
||||
// Handle validation errors from workflow dispatch
|
||||
if (
|
||||
message == 'Unexpected inputs provided' ||
|
||||
(message.startsWith('Required input') && message.endsWith('not provided'))
|
||||
(message.startsWith('Required input') &&
|
||||
message.endsWith('not provided')) ||
|
||||
message.startsWith('No ref found for:') ||
|
||||
message == `Workflow does not have 'workflow_dispatch' trigger`
|
||||
) {
|
||||
core.setOutput('error-message', message)
|
||||
core.warning(message)
|
||||
|
||||
Reference in New Issue
Block a user