elastic / elastic/integrations

[bug-hunter] get_release_commit.sh -h exits with status 1 instead of 0

Open
#19,289 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Handlebars
Stars
333
Forks
647
Avg merge
3d 4h
Merged PRs (30d)
209

Description

## Impact
Contributors using `dev/scripts/get_release_commit.sh` in automation cannot safely call `-h` for usage output because it returns a non-zero exit code. This can fail wrappers/CI checks that treat help output as a successful command.

## Reproduction Steps
1. Create and run this minimal repro script:

```bash
#!/usr/bin/env bash
set -euo pipefail

cd /home/runner/work/integrations/integrations

set +e
output="$(dev/scripts/get_release_commit.sh -h 2>&1)"
status=$?
set -e

printf '%s\n' "$output"
printf 'EXIT:%s\n' "$status"

if [[ "$status" -eq 0 ]]; then
echo "PASS: help exits successfully"
exit 0
fi

echo "FAIL: help exits with non-zero status"
exit 1
```

2. Execute it:

```bash
chmod +x /tmp/gh-aw/agent/repro_get_release_commit_help.sh
/tmp/gh-aw/agent/repro_get_release_commit_help.sh
```

## Expected vs Actual
**Expected:** `dev/scripts/get_release_commit.sh -h` prints usage and exits with status `0`.

**Actual:** it prints usage and exits with status `1`.

Observed output:

```text
Usage: dev/scripts/get_release_commit.sh -p -v
EXIT:1
FAIL: help exits with non-zero status
```

## Failing Test
```bash
#!/usr/bin/env bash
set -euo pipefail

cd /home/runner/work/integrations/integrations

set +e
output="$(dev/scripts/get_release_commit.sh -h 2>&1)"
status=$?
set -e

printf '%s\n' "$output"
printf 'EXIT:%s\n' "$status"

if [[ "$status" -eq 0 ]]; then
echo "PASS: help exits successfully"
exit 0
fi

echo "FAIL: help exits with non-zero status"
exit 1
```

## Evidence
- `dev/scripts/get_release_commit.sh:7-10`:
- `usage()` always calls `exit 1`.
- `dev/scripts/get_release_commit.sh:19-22`:
- `-h` branch calls `usage` and then `exit 0`, but `exit 0` is unreachable because `usage` already exits with `1`.
- File introduced recently in commit `cc89b23313` (`Add backport release commit helper script and improve hotfix workflow docs (#19104)`).

> [!NOTE]
>
> 🔒 Integrity filter blocked 1 item
>
> The following item were blocked because they don't meet the GitHub integrity level.
>
> - [#1](https://github.com/elastic/integrations/pull/1) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
>
> To allow these resources, lower `min-integrity` in your GitHub frontmatter:
>
> ```yaml
> tools:
> github:
> min-integrity: approved # merged | approved | unapproved | none
> ```
>
>

---
[What is this?](https://ela.st/github-ai-tools) | [From workflow: Bug Hunter](https://github.com/elastic/integrations/actions/runs/26636212500)

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
> - [x] expires on Jun 5, 2026, 12:23 PM UTC

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.