Skip to content

Commit 2db48f6

Browse files
committed
1. change the name of the action to run-bash-command; 2. change the input time to timelimit
1 parent f796895 commit 2db48f6

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# success-on-timeout
1+
# run-bash-command
22

3-
Run one or more commands with a time cap in GitHub Actions. If the command **times out**, this action **treats it as success** (exits `0`). If the command **fails before** the time cap, the action **fails** with the command’s exit code.
3+
Run one or more commands with a time limit in GitHub Actions. If the command **times out**, this action **treats it as success** (exits `0`). If the command **fails before** the time limit, the action **fails** with the command’s exit code.
44

55
This is useful for long-running stress tests where “ran long enough without crashing” is considered a pass.
66

@@ -25,9 +25,9 @@ GNU `timeout` returns exit code **124** when the time limit is reached; this act
2525

2626
```yaml
2727
- name: Conduct the test; treat timeout as SUCCESS (exit 0)
28-
uses: equipez/success-on-timeout@v1
28+
uses: equipez/run-bash-command@v1
2929
with:
30-
time: 350m
30+
timelimit: 350m
3131
command: |
3232
command1
3333
command2 argA argB
@@ -39,9 +39,9 @@ GNU `timeout` returns exit code **124** when the time limit is reached; this act
3939
```yaml
4040
- name: Run stress test (timeout => success)
4141
id: stress
42-
uses: equipez/success-on-timeout@v1
42+
uses: equipez/run-bash-command@v1
4343
with:
44-
time: 350m
44+
timelimit: 350m
4545
command: |
4646
./stress-test --big
4747
@@ -57,7 +57,7 @@ GNU `timeout` returns exit code **124** when the time limit is reached; this act
5757
5858
| Name | Required | Default | Description |
5959
|---|---:|---|---|
60-
| `time` | yes | — | Time limit passed to `(g)timeout` (e.g. `300s`, `45m`, `2h`). |
60+
| `timelimit` | yes | — | Time limit passed to `(g)timeout` (e.g. `300s`, `45m`, `2h`). |
6161
| `command` | yes | — | Command(s) to run. Multiline supported. |
6262
| `signal` | no | `TERM` | Signal sent when the time limit is reached. |
6363
| `kill-after` | no | `30s` | Wait time before sending `SIGKILL` after `signal`. |
@@ -81,9 +81,9 @@ GNU `timeout` returns exit code **124** when the time limit is reached; this act
8181
### 1) Treat “ran 30 minutes” as pass, but fail on real errors
8282

8383
```yaml
84-
- uses: equipez/success-on-timeout@v1
84+
- uses: equipez/run-bash-command@v1
8585
with:
86-
time: 30m
86+
timelimit: 30m
8787
command: |
8888
./run-long-test-suite
8989
```
@@ -97,9 +97,9 @@ GNU `timeout` returns exit code **124** when the time limit is reached; this act
9797
Some processes prefer `INT` (Ctrl+C) or `HUP` for graceful shutdown:
9898

9999
```yaml
100-
- uses: equipez/success-on-timeout@v1
100+
- uses: equipez/run-bash-command@v1
101101
with:
102-
time: 50m
102+
timelimit: 50m
103103
signal: INT
104104
kill-after: 20s
105105
command: |
@@ -109,9 +109,9 @@ Some processes prefer `INT` (Ctrl+C) or `HUP` for graceful shutdown:
109109
### 3) Set a working directory
110110

111111
```yaml
112-
- uses: equipez/success-on-timeout@v1
112+
- uses: equipez/run-bash-command@v1
113113
with:
114-
time: 20m
114+
timelimit: 20m
115115
working-directory: matlab/tests
116116
command: |
117117
./run_tests.sh
@@ -133,7 +133,7 @@ If you set `install-coreutils: false`, ensure `gtimeout` is already available on
133133

134134
## Important notes & limitations
135135

136-
- **GitHub-hosted runner hard limit still applies.** Choose `time` with a buffer below your job’s `timeout-minutes` and below GitHub’s platform limit.
136+
- **GitHub-hosted runner hard limit still applies.** Choose `timelimit` with a buffer below your job’s `timeout-minutes` and below GitHub’s platform limit.
137137
- **This action requires Bash and `(g)timeout`.** It is intended for `ubuntu-latest` and `macos-latest` runners.
138138
- **Timeout is treated as success by design.** Only use this when “time limit reached without crashing” is an acceptable success criterion.
139139
- **Exit code semantics:** GNU `timeout` uses `124` for timeouts. If your wrapped command itself returns `124`, it will be indistinguishable from a timeout in this action’s current design.

action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: "Success on Timeout"
2-
description: "Run commands with a time cap; if the cap is reached, terminate the command and return success (exit 0)."
2+
description: "Run commands with a time limit; if the limit is reached, terminate the command and return success (exit 0)."
33
author: "L'Équipe Z (equipez)"
44

55
branding:
66
icon: "clock"
77
color: "blue"
88

99
inputs:
10-
time:
10+
timelimit:
1111
description: "Time limit passed to (g)timeout (e.g., 300s, 45m, 2h)."
1212
required: true
1313

@@ -43,10 +43,10 @@ inputs:
4343
outputs:
4444
timed_out:
4545
description: "true if the command hit the time limit (and was treated as success)."
46-
value: ${{ steps.sot.outputs.timed_out }}
46+
value: ${{ steps.rbc.outputs.timed_out }}
4747
exit_code:
4848
description: "The underlying command exit code (124 means timeout in coreutils semantics)."
49-
value: ${{ steps.sot.outputs.exit_code }}
49+
value: ${{ steps.rbc.outputs.exit_code }}
5050

5151
runs:
5252
using: "composite"
@@ -61,11 +61,11 @@ runs:
6161
brew install coreutils
6262
fi
6363
64-
- id: sot
64+
- id: rbc
6565
name: Run with (g)timeout; timeout => success
6666
shell: bash
6767
env:
68-
INPUT_TIME: ${{ inputs.time }}
68+
INPUT_TIME: ${{ inputs.timelimit }}
6969
INPUT_COMMAND: ${{ inputs.command }}
7070
INPUT_SIGNAL: ${{ inputs.signal }}
7171
INPUT_KILL_AFTER: ${{ inputs.kill-after }}

run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -Eeuo pipefail
33

4-
: "${INPUT_TIME:?Missing input: time}"
4+
: "${INPUT_TIME:?Missing input: timelimit}"
55
: "${INPUT_COMMAND:?Missing input: command}"
66
: "${INPUT_SIGNAL:=TERM}"
77
: "${INPUT_KILL_AFTER:=30s}"
@@ -32,15 +32,15 @@ if [[ -n "${INPUT_WORKING_DIRECTORY}" ]]; then
3232
fi
3333

3434
# Write the user commands to a temp script (multiline supported)
35-
cmdfile="${RUNNER_TEMP:-/tmp}/success-on-timeout-cmd.sh"
35+
cmdfile="${RUNNER_TEMP:-/tmp}/run-bash-command-cmd.sh"
3636
cat >"$cmdfile" <<'HEADER'
3737
#!/usr/bin/env bash
3838
set -Eeuo pipefail
3939
HEADER
4040
printf '%s\n' "${INPUT_COMMAND}" >>"$cmdfile"
4141
chmod +x "$cmdfile"
4242

43-
log "success-on-timeout: using ${TIMEOUT_BIN}, limit=${INPUT_TIME}, signal=${INPUT_SIGNAL}, kill-after=${INPUT_KILL_AFTER}"
43+
log "run-bash-command: using ${TIMEOUT_BIN}, limit=${INPUT_TIME}, signal=${INPUT_SIGNAL}, kill-after=${INPUT_KILL_AFTER}"
4444

4545
set +e
4646
"$TIMEOUT_BIN" \
@@ -58,7 +58,7 @@ fi
5858

5959
# coreutils: 124 indicates timeout
6060
if [[ $rc -eq 124 ]]; then
61-
log "success-on-timeout: time limit reached -> treating as SUCCESS (exit 0)."
61+
log "run-bash-command: time limit reached -> treating as SUCCESS (exit 0)."
6262
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
6363
echo "timed_out=true" >>"$GITHUB_OUTPUT"
6464
fi

0 commit comments

Comments
 (0)