Skip to content

Commit 6d00b48

Browse files
committed
init
1 parent 2bf5fbd commit 6d00b48

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

action.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ inputs:
5050
variant:
5151
description: User specified variant of a set of tests being uploaded.
5252
required: false
53+
previous-step-outcome:
54+
description: The outcome of the previous step in the workflow. Set this equal to steps.[id].outcome where `[id]` is the id of the corresponding test run.
55+
required: false
5356

5457
runs:
5558
using: composite
@@ -73,3 +76,4 @@ runs:
7376
PR_TITLE: ${{ github.event.pull_request.title }}
7477
HIDE_BANNER: ${{ inputs.hide-banner }}
7578
VARIANT: ${{ inputs.variant }}
79+
PREVIOUS_STEP_OUTCOME: ${{ inputs.previous-step-outcome }}

script.sh

+9
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ BAZEL_BEP_PATH="${BAZEL_BEP_PATH-}"
7474
ALLOW_MISSING_JUNIT_FILES_ARG=$(parse_bool "${ALLOW_MISSING_JUNIT_FILES}" "--allow-missing-junit-files")
7575
HIDE_BANNER=$(parse_bool "${HIDE_BANNER}" "--hide-banner")
7676
QUARANTINE_ARG=$(parse_bool "${QUARANTINE}" "--use-quarantining")
77+
if [[ -n ${PREVIOUS_STEP_OUTCOME} ]]; then
78+
if [[ ${PREVIOUS_STEP_OUTCOME} == "success" ]]; then
79+
PREVIOUS_STEP_OUTCOME="0"
80+
else
81+
PREVIOUS_STEP_OUTCOME="1"
82+
fi
83+
fi
7784
VARIANT="${VARIANT-}"
7885

7986
# CLI.
@@ -99,6 +106,7 @@ if [[ $# -eq 0 ]]; then
99106
${REPO_HEAD_BRANCH:+--repo-head-branch "${REPO_HEAD_BRANCH}"} \
100107
--repo-root "${REPO_ROOT}" \
101108
--team "${TEAM}" \
109+
${PREVIOUS_STEP_OUTCOME:+--previous-step-outcome "${PREVIOUS_STEP_OUTCOME}"} \
102110
${ALLOW_MISSING_JUNIT_FILES_ARG} \
103111
${HIDE_BANNER} \
104112
${VARIANT:+--variant "${VARIANT}"} \
@@ -113,6 +121,7 @@ else
113121
${REPO_HEAD_BRANCH:+--repo-head-branch "${REPO_HEAD_BRANCH}"} \
114122
--repo-root "${REPO_ROOT}" \
115123
--team "${TEAM}" \
124+
${PREVIOUS_STEP_OUTCOME:+--previous-step-outcome "${PREVIOUS_STEP_OUTCOME}"} \
116125
${ALLOW_MISSING_JUNIT_FILES_ARG} \
117126
${HIDE_BANNER} \
118127
${VARIANT:+--variant "${VARIANT}"} \

tests/arguments.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ test("Forwards inputs", async () => {
3838
ALLOW_MISSING_JUNIT_FILES: "",
3939
BAZEL_BEP_PATH: "",
4040
HIDE_BANNER: "",
41+
PREVIOUS_STEP_OUTCOME: "success",
4142
};
4243

4344
const scriptPath = path.resolve(repoRoot, "script.sh");
@@ -57,7 +58,7 @@ test("Forwards inputs", async () => {
5758
}
5859
expect({ stdout, stderr, exit_code }).toMatchObject({
5960
stdout:
60-
"upload --junit-paths junit.xml --org-url-slug org --token token --repo-root --team",
61+
"upload --junit-paths junit.xml --org-url-slug org --token token --repo-root --team --previous-step-outcome 0",
6162
stderr: `+ [[ 0.0.0 == \\l\\a\\t\\e\\s\\t ]]
6263
+ [[ -f ./trunk-analytics-cli ]]
6364
+ chmod +x ./trunk-analytics-cli

0 commit comments

Comments
 (0)