From 5992ca181097604f08d815a712287c0cabd902fd Mon Sep 17 00:00:00 2001 From: insleker Date: Wed, 8 Apr 2026 23:57:30 +0800 Subject: [PATCH] fix: send GitHub webhook active flag as boolean (#25) GitHub rejects webhook creation when gh api serializes active as a string. Use a typed field so gh sends a real boolean, and lock the gh/gosmee integration test harness to catch regressions. --- lib/src/issue_tracker_client.dart | 2 +- .../github_gosmee_test.dart | 4 +++- test/test_support.dart | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/src/issue_tracker_client.dart b/lib/src/issue_tracker_client.dart index 3eb6038..a5403e6 100644 --- a/lib/src/issue_tracker_client.dart +++ b/lib/src/issue_tracker_client.dart @@ -158,7 +158,7 @@ class IssueTrackerClient { _buildApiPath(repo, ['hooks']), '-f', 'name=web', - '-f', + '-F', 'active=true', '-f', 'events[]=issues', diff --git a/test/issue_assistant_app_run/github_gosmee_test.dart b/test/issue_assistant_app_run/github_gosmee_test.dart index ae93e2b..c4da084 100644 --- a/test/issue_assistant_app_run/github_gosmee_test.dart +++ b/test/issue_assistant_app_run/github_gosmee_test.dart @@ -145,7 +145,9 @@ projects: final ghLogLines = await ghLog.readAsLines(); expect( ghLogLines.any( - (line) => line.contains('api -X POST repos/owner/sample/hooks'), + (line) => + line.contains('api -X POST repos/owner/sample/hooks') && + line.contains('-F active=true'), ), isTrue, ); diff --git a/test/test_support.dart b/test/test_support.dart index d3ce6c7..a569a37 100644 --- a/test/test_support.dart +++ b/test/test_support.dart @@ -634,6 +634,22 @@ Future writeGitHubGosmeeGhScript({ buffer ..writeln('if [[ "\$1" == "api" && "\$4" == "repos/$repo/hooks" ]]; then') + ..writeln(r''' active_flag=""''') + ..writeln(r''' for ((i = 1; i <= $#; i += 1)); do''') + ..writeln(r''' if [[ "${!i}" == "active=true" ]]; then''') + ..writeln(r''' prev_index=$((i - 1))''') + ..writeln(r''' active_flag="${!prev_index}"''') + ..writeln(r''' break''') + ..writeln(r''' fi''') + ..writeln(r''' done''') + ..writeln( + r''' if [[ "$active_flag" != "-F" && "$active_flag" != "--field" ]]; then''', + ) + ..writeln( + r''' echo "expected active=true to be sent with -F/--field, got: $*" >&2''', + ) + ..writeln(r''' exit 1''') + ..writeln(r''' fi''') ..writeln(" cat <<'JSON'") ..writeln(jsonEncode({'id': webhookId})) ..writeln('JSON')