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.
This commit is contained in:
parent
4df29b1508
commit
5992ca1810
|
|
@ -158,7 +158,7 @@ class IssueTrackerClient {
|
|||
_buildApiPath(repo, ['hooks']),
|
||||
'-f',
|
||||
'name=web',
|
||||
'-f',
|
||||
'-F',
|
||||
'active=true',
|
||||
'-f',
|
||||
'events[]=issues',
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -634,6 +634,22 @@ Future<void> 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')
|
||||
|
|
|
|||
Loading…
Reference in New Issue