Skip to content

Commit 7a5664a

Browse files
[Bug]: prevent label-sync failures when no issue is linked (#157) (#158)
* [label-sync] Skip missing linked issue references (#157) * Update wiki submodule pointer for PR #158 * [changelog] Keep unreleased label-sync fix under Unreleased (#157) * [label-sync] Use bash regex for linked issue detection (#157) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 7c24cc3 commit 7a5664a

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

.github/actions/label-sync/copy-linked-issue-labels/run.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ set -euo pipefail
44
title="$(jq -r '.pull_request.title // ""' "${GITHUB_EVENT_PATH}")"
55
body="$(jq -r '.pull_request.body // ""' "${GITHUB_EVENT_PATH}")"
66
pull_request_number="$(jq -r '.pull_request.number // ""' "${GITHUB_EVENT_PATH}")"
7-
issue_number="$(
8-
printf '%s %s\n' "${title}" "${body}" \
9-
| grep -oiE '(closes|fixes|resolves|addresses)\s+#[[:digit:]]+' \
10-
| grep -oE '#[[:digit:]]+' \
11-
| head -1 \
12-
| tr -d '#'
13-
)"
7+
issue_number=''
8+
9+
linked_issue_pattern='(closes|fixes|resolves|addresses)[[:space:]]+#([[:digit:]]+)'
10+
11+
if [[ "${title} ${body}" =~ ${linked_issue_pattern} ]]; then
12+
issue_number="${BASH_REMATCH[2]}"
13+
fi
1414

1515
if [ -z "${issue_number}" ]; then
1616
echo "No linked issue was found in the pull request title or body."

.github/wiki

Submodule wiki updated from d6fbde3 to 7211e3c

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Keep the packaged pull-request label-sync action from failing when a PR does not reference any linked issue (#157)
13+
1014
## [1.17.0] - 2026-04-22
1115

1216
### Added

0 commit comments

Comments
 (0)