Skip to content

Commit f589bf6

Browse files
committed
feat(runner): enhance runner name configuration options
- Introduces an option to use hostname as the runner name by setting `GITHUB_RUNNER_USE_HOSTNAME` to "true". - Updates the behavior to prefer hostname over provided runner name when the flag is enabled. - Provides fallback to hostname if no name is provided and the flag is not true. - Improves documentation to clarify the new behavior and configuration options.
1 parent 5192ca0 commit f589bf6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ In ephemeral mode, the runner will:
9191
#### Environment Variables
9292
- `GITHUB_RUNNER_URL` (required): Repository, organization, or enterprise URL
9393
- `GITHUB_RUNNER_PAT` or `GITHUB_RUNNER_TOKEN` (required): Authentication token
94-
- `GITHUB_RUNNER_NAME` (optional): Runner name (defaults to hostname)
94+
- `GITHUB_RUNNER_NAME` (optional): Runner name (defaults to hostname, can be overridden by GITHUB_RUNNER_USE_HOSTNAME)
95+
- `GITHUB_RUNNER_USE_HOSTNAME` (optional): Set to "true" to always use container hostname as runner name, overriding GITHUB_RUNNER_NAME
9596
- `GITHUB_RUNNER_LABELS` (optional): Comma-separated list of labels
9697
- `GITHUB_RUNNER_GROUP` (optional): Runner group name
9798
- `GITHUB_RUNNER_WORKDIR` (optional): Working directory for jobs

src/entrypoint.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,15 @@ configure_runner() {
9191
exit 1
9292
fi
9393

94-
# Add runner name (use hostname as default)
95-
if [ -n "${GITHUB_RUNNER_NAME}" ]; then
94+
# Add runner name (with hostname preference option)
95+
if [ "${GITHUB_RUNNER_USE_HOSTNAME}" = "true" ]; then
96+
# When flag is true, always use hostname regardless of GITHUB_RUNNER_NAME
97+
CONFIG_CMD="${CONFIG_CMD} --name \"$(hostname)\""
98+
elif [ -n "${GITHUB_RUNNER_NAME}" ]; then
99+
# Use provided name if flag is not true and name is provided
96100
CONFIG_CMD="${CONFIG_CMD} --name \"${GITHUB_RUNNER_NAME}\""
97101
else
102+
# Fall back to hostname if no name provided and flag is not true
98103
CONFIG_CMD="${CONFIG_CMD} --name \"$(hostname)\""
99104
fi
100105

0 commit comments

Comments
 (0)