Skip to content

Commit

Permalink
fix: fix regression in cmd result processing (#6867)
Browse files Browse the repository at this point in the history
This should fix a regression introduced in
#6850.

Because we added a lookup into `graphResult.result` and
`graphResult.result` can be null in certain circumstances (e.g. when the
action fails), we needed to guard against this (since we don't want an
internal error for such cases).
  • Loading branch information
thsig authored Feb 20, 2025
1 parent 74f2efd commit f2f80ca
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/commands/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ function commonResultFields(graphResult: GraphResultWithoutTask) {
inputVersion: graphResult.inputVersion,
// Here for backwards-compatibility
version: graphResult.inputVersion,
actionState: graphResult.result.state as ActionState,
actionState: graphResult.result ? (graphResult.result.state as ActionState) : "unknown",
}
}

Expand Down
52 changes: 47 additions & 5 deletions docs/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ aborted:
# Set to false if the command execution was unsuccessful.
success:

# A map of all executed Builds (or Builds scheduled/attempted) and information about the them.
# A map of all executed Builds (or Builds scheduled/attempted) and information about them.
build:
<Build name>:
# The full log from the build.
Expand Down Expand Up @@ -110,6 +110,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -147,6 +149,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -236,6 +240,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -323,6 +329,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -1028,7 +1036,7 @@ aborted:
# Set to false if the command execution was unsuccessful.
success:
# A map of all executed Builds (or Builds scheduled/attempted) and information about the them.
# A map of all executed Builds (or Builds scheduled/attempted) and information about them.
build:
<Build name>:
# The full log from the build.
Expand Down Expand Up @@ -1063,6 +1071,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -1100,6 +1110,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -1189,6 +1201,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -1276,6 +1290,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -4216,7 +4232,7 @@ aborted:
# Set to false if the command execution was unsuccessful.
success:
# A map of all executed Builds (or Builds scheduled/attempted) and information about the them.
# A map of all executed Builds (or Builds scheduled/attempted) and information about them.
build:
<Build name>:
# The full log from the build.
Expand Down Expand Up @@ -4251,6 +4267,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -4288,6 +4306,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -4377,6 +4397,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -4464,6 +4486,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -4576,6 +4600,8 @@ published:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -4626,7 +4652,7 @@ aborted:
# Set to false if the command execution was unsuccessful.
success:
# A map of all executed Builds (or Builds scheduled/attempted) and information about the them.
# A map of all executed Builds (or Builds scheduled/attempted) and information about them.
build:
<Build name>:
# The full log from the build.
Expand Down Expand Up @@ -4661,6 +4687,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -4698,6 +4726,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -4787,6 +4817,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -4874,6 +4906,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -5194,7 +5228,7 @@ aborted:
# Set to false if the command execution was unsuccessful.
success:
# A map of all executed Builds (or Builds scheduled/attempted) and information about the them.
# A map of all executed Builds (or Builds scheduled/attempted) and information about them.
build:
<Build name>:
# The full log from the build.
Expand Down Expand Up @@ -5229,6 +5263,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -5266,6 +5302,8 @@ build:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -5355,6 +5393,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down Expand Up @@ -5442,6 +5482,8 @@ deploy:
# action tasks, this will generally be the unresolved version.
version:

actionState:

# A map of values output from the action's execution.
outputs:
<name>:
Expand Down

0 comments on commit f2f80ca

Please sign in to comment.