Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ GitHub Actions for running [CodSpeed](https://codspeed.io) in your CI.
# Set to "true" to enable. Requires runner v5.2.0 or later.
# Defaults to "false".
simulation-track-subprocess: ""

# [OPTIONAL]
# Allow the action to complete successfully even if the benchmark results could not be
# uploaded to CodSpeed, for instance because a workflow triggered from a fork cannot
# access the CodSpeed token. Failures of the benchmarks themselves still fail the
# action. Set to "true" to enable. Defaults to "false".
allow-upload-failure: "false"
```

# Example usage
Expand Down
29 changes: 29 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ inputs:
required: false
default: "false"

allow-upload-failure:
description: |
Allow the action to complete successfully even if the benchmark results could not be uploaded to
CodSpeed, because of an authentication or an upload error.
This is useful for workflows triggered from forks. Failures of the benchmarks themselves still fail the action.
Requires a runner version that reports dedicated exit codes for these failures; with older runners,
the action fails as usual. Defaults to 'false'.
required: false
default: "false"

go-runner-version:
description: "The version of the go-runner to use (e.g., 1.0.0, 1.0.0-beta.1). If not specified, the latest version will be installed"
required: false
Expand Down Expand Up @@ -307,4 +317,23 @@ runs:
fi

# Run the benchmarks
set +e
codspeed run "${RUNNER_ARGS[@]}"
EXIT_CODE=$?
set -e

# The runner exits with 4 for auth errors and 5 for other upload errors.
if [ "${{ inputs.allow-upload-failure }}" = "true" ]; then
case "$EXIT_CODE" in
4)
echo "::warning title=CodSpeed results not uploaded::Could not authenticate against CodSpeed, so the benchmark results were not uploaded. Continuing because 'allow-upload-failure' is enabled."
exit 0
;;
5)
echo "::warning title=CodSpeed results not uploaded::The benchmarks ran, but their results could not be uploaded to CodSpeed. Continuing because 'allow-upload-failure' is enabled."
exit 0
;;
esac
fi

exit $EXIT_CODE