Skip to content

feat: warn when a newer PiHoleShell release is available - #136

Merged
mikemadeja merged 1 commit into
developfrom
feature/update-check
Oct 3, 2026
Merged

mikemadeja merged 1 commit into
developfrom
feature/update-check

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

  • Adds a best-effort, cached check on module import that compares the installed version against GitHub's latest release (GET /repos/mikemadeja/PiHoleShell/releases/latest) and prints a warning if a newer one exists
  • Designed to never slow down or break Import-Module:
    • Skipped entirely for a dev/source checkout - importing the bare .psm1 (as every test in this repo's suite does) gets PowerShell's auto-assigned version 0.0, and importing via the manifest gets the 0.0.0 placeholder that's only replaced at publish time; both are explicitly treated as "not a real install" and skipped, so this never fires during CI/local test runs
    • Cached to disk for 24 hours so repeat imports don't hit the network or GitHub's unauthenticated rate limit
    • Opt-out via $env:PIHOLESHELL_SKIP_UPDATE_CHECK for automation that wants no network calls at all
    • GitHub's "latest release" endpoint already excludes prereleases/drafts, so the dev-latest build published on every push to develop is never mistaken for a real update
    • Any failure (network, parsing) is swallowed silently via try/catch - it can never break a real import
  • Documented in the README's Installation section

Test plan

  • Unit tests (8, mocked, no server dependency): dev-checkout versions (both 0.0 and 0.0.0) skip the check, opt-out env var skips the check, warns and caches on a real newer version, no warning when already current/newer, cache reuse within the interval, re-check after cache expiry, never throws on API failure
  • Manually confirmed against the live GitHub API that an old version warns correctly and a current/newer version stays silent
  • Confirmed importing the module from source (both Import-Module .\PiHoleShell.psm1 and via a bare .psm1) produces zero warnings and zero network calls
  • PSScriptAnalyzer clean
  • Full non-integration unit suite passes (12/12)

🤖 Generated with Claude Code

Adds a best-effort, cached check on module import that compares the
installed version against GitHub's latest release and warns if a
newer one exists. Designed to never slow down or break Import-Module:

- Skipped entirely for a dev/source checkout (version 0.0 or 0.0.0,
  depending on whether the module or its manifest was imported), so
  it never fires during this repo's own test suite
- Cached for 24 hours so repeat imports don't hit the network or
  GitHub's rate limit
- Opt-out via $env:PIHOLESHELL_SKIP_UPDATE_CHECK for automation
- GitHub's "latest release" endpoint already excludes the dev-latest
  prerelease build, so that's never mistaken for a real update
- Any failure (network, parsing) is swallowed silently

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mikemadeja
mikemadeja merged commit 817708e into develop Oct 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant