Skip to content

v1.5.5

Choose a tag to compare

@tobrien tobrien released this 31 Jan 23:46
· 6 commits to working since this release
0d5d6aa

Summary

  • This release (1.5.5) focuses on expanding GitHub integration and automation helpers, improving reliability and diagnostics when creating or merging pull requests and when waiting for CI/workflow runs. It also tightens error handling and adds a few developer-facing extension points (e.g., injectable prompt function). Several CI/workflow and package metadata files were updated.

Why it matters

  • The library is now better at detecting repository context (including environments where repo info is provided externally), more robust when creating PRs (handles parallel races and GitHub 422 errors with helpful recovery instructions), and safer when waiting on checks or release-triggered workflows (more diagnostic logging and sensible fallback behavior).
  • Users automating releases or merges will see clearer error messages and fewer false negatives when workflows are missing or not configured for pull_request events.
  • Developers can inject a custom prompt function for interactive/non-interactive behavior in tests and automation.

Notable changes (user + developer visible)

  • New injectable prompt behavior
    • Added a default non-interactive prompt (defaulting to YES) and exported setPromptFunction(fn) to allow tests or callers to supply a custom PromptFunction.
    • Impact: automation that relies on interactive confirmation can now be controlled programmatically. Default behavior will automatically proceed when running non-interactively (this affects flows that time out waiting for checks or workflows).
  • Repository detection improvements
    • getRepoDetails now first reads repository owner/name from environment variables (KODRDRIV_CONTEXT_REPOSITORY_OWNER and KODRDRIV_CONTEXT_REPOSITORY_NAME) when present — useful for parallel/agentic execution contexts.
    • Fallback git remote URL parsing improved to handle SSH aliases and multiple host formats; clearer error messages when parsing fails.
  • Pull request creation robustness
    • PR title is now truncated to GitHub's 256-character limit; truncation preserves word boundaries where reasonable and logs the change.
    • createPullRequest includes a pre-flight reuse check and stronger recovery for 422 errors: if a PR was created concurrently after the initial check, the library now tries to detect and reuse it instead of failing.
    • Errors from failed PR creation produce enhanced error objects with detailed recovery instructions (via errors.PullRequestCreationError).
  • Waiting for checks / workflow runs
    • waitForPullRequestChecks improved to:
      • Retry and, after repeated "no checks" responses, inspect repository workflow configuration to determine if checks will ever appear.
      • Distinguish cancelled checks (informational) from actual failures.
      • When workflows exist but are not triggered for the PR, provide clear guidance and prompt the user (or proceed in non-interactive mode).
      • Gather additional details for failing checks (check run output, summary, links) and provide a PullRequestCheckError with recovery steps.
    • New functions for release-triggered workflows:
      • getWorkflowRunsTriggeredByRelease, waitForReleaseWorkflows and getWorkflowsTriggeredByRelease that locate and wait for workflows started by a given release tag. These functions include logic to filter runs by release creation time, commit, and event pattern, and to retry/timeout with prompts when nothing appears.
    • These additions improve reliability when automating release verification and when CI is expected to run on releases.
  • Workflow analysis helpers
    • Added isTriggeredByPullRequest and isTriggeredByRelease (regex-based YAML inspection) so the library can infer whether a workflow is likely to trigger on pull_request or release events without depending on a YAML parser.
    • These are used by workflow-checking functions to produce warnings and better user prompts.
  • Release creation and notes handling
    • createRelease unescapes escaped newline/tab sequences in title and body (handles cases where notes were JSON-serialized and contain literal
      sequences).
    • New functions that build release notes from closed issues and milestones:
      • ensureMilestoneForVersion, closeMilestoneForVersion, getMilestoneIssuesForRelease and helpers that fetch and assemble closed issue details for release notes (includes token-budgeted content collection to avoid huge payloads).
  • Issue & milestone helpers
    • New and enhanced functions to find/create/close milestones, move issues between milestones, and collect issue details (with simple token estimation). These are defensive and intentionally continue on failure (log warnings) rather than crashing the whole flow.
  • Error handling & logging
    • More diagnostic logging throughout GitHub flows — better debug messages for repo parsing, workflow analysis, and run filtering to help operators understand why checks or workflows are not appearing.
    • When GitHub API calls fail in expected ways (e.g., permission issues), the library tries to avoid spurious noisy logs and provides clearer hints in warnings/errors.

Other repository changes

  • Tests and test configuration updated (tests/github.test.ts, vitest.config.ts).
  • CI/workflow files updated (.github/workflows/**) — adjustments to test and publish workflows.
  • package.json metadata and release/publish workflow updates; dependabot config was changed/removed.

Files changed (high level)

  • src/github.ts — many functional additions and refactors described above (majority of changes).
  • tests/github.test.ts — updated tests to reflect new behaviors and injection points.
  • vitest.config.ts — test runner config updates.
  • .github/workflows/* — CI/test/publish workflow tweaks.
  • package.json — metadata/version-related adjustments.

Breaking changes and important considerations

  • No explicit breaking API changes were detected by automated scanning. Most changes are additive.
  • Be aware of the following behavioral changes that may affect automation:
    • Default prompt behavior: If your automation previously depended on an interactive prompt blocking until the user responded, the new default prompt function will "default to YES" in non-interactive contexts. If you need different behavior, inject a prompt function with setPromptFunction.
    • PR title truncation: Titles longer than 256 characters will be truncated (GitHub limit). The library now truncates and logs this; code that relied on full-length titles being accepted should be prepared for truncation.
    • getRepoDetails environment variables: If your runtime environment sets KODRDRIV_CONTEXT_REPOSITORY_OWNER / _NAME, those values will now be preferred over git remote detection. This is intended, but if you have workflows that set these values incorrectly it could change behavior.
    • createRelease unescapes escaped newlines/tabs in title/body: If you previously relied on literal backslash sequences in release bodies, they will now be unescaped.
  • GITHUB_TOKEN is still required for Octokit calls; functions will throw if token is not set. Improved error messages make the cause clearer.

Migration & usage notes

  • If you use the library in fully automated CI (non-interactive), no additional configuration is required — the library will proceed in non-interactive mode and will prompt-less choose to continue when appropriate. If you want to control prompts (accept/deny), call setPromptFunction at startup to provide deterministic behavior for your environment.
  • If you need strict blocking behavior on timeouts or when no workflows are present, pass skipUserConfirmation: false and provide a prompt function that throws or returns false to prevent automated proceeding.
  • The new milestone and release-note helpers are optional: they are used by higher-level release workflows but can be ignored if you prefer to manage milestones/releases separately.

Developer notes

  • The prompt injection (setPromptFunction) makes testing flows that require user confirmation simple and deterministic — tests can inject a fake prompt to exercise both proceed/abort flows.
  • Workflow parsing uses lightweight regex heuristics (no YAML dependency). This is intentionally tolerant; if you need exact YAML semantics consider supplying your own checks or pre-parsing workflow content before calling these helpers.
  • Error classes for PR creation and check failures were introduced/used; callers that previously caught generic Errors may find more structured information by catching PullRequestCreationError or PullRequestCheckError (see errors module for API).

Release metadata

  • Version: 1.5.5
  • Commits: 16
  • Files changed: 7 (notable: src/github.ts, tests/github.test.ts, CI workflows)
  • Insertions: ~73, Deletions: ~64

If you maintain downstream automation, review the prompt/default-behavior and PR title constraints and update any scripts that relied on previous (less-diagnostic) behaviors. Overall, this release improves robustness, observability, and gives maintainers better control over interactive confirmations and release workflow detection.