Search by

valgorithms / discord-changelog

valzargaming

GitHub commits -> Discord webhook watcher

Package info

github.com/Valgorithms/discord-changelog

pkg:composer/valgorithms/discord-changelog

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-05-28 13:15 UTC

This package is auto-updated.

Last update: 2026-10-28 20:52:42 UTC


README

Discord changelog webhook watcher

Small PSR-4 CLI that watches a GitHub repo's commits and posts new commits to a Discord webhook (skips commits that mention "Social SDK").

Quick start

  • Install dependencies:
composer install
  • Copy and edit environment variables:
cp .env.example .env
# Edit .env and set DISCORD_WEBHOOK and GITHUB_REPO_API

-- Run the CLI (from the project root):

# Preferred: run the bootstrap which locates .env
php run.php

Bootstrap helper

  • run.php is the project's bootstrap. It prefers .env beside the script, then searches the working directory and its parents, then the script's parents. It ensures last_commit.txt exists; run it with php /path/to/run.php from any directory.

Configuration

  • Environment variables are defined in .env (see .env.example). Existing process, $_ENV, and $_SERVER values take precedence over the file. The file is required even when configuration is supplied by the environment. The loader accepts KEY=value lines, skips blank/comment/malformed lines, and strips one matching pair of surrounding quotes. It preserves embedded = and # characters; shell expansion, interpolation, and inline comments are not supported.
    • DISCORD_WEBHOOK — your Discord webhook URL (don't leave as CHANGEME).
    • GITHUB_REPO_API — GitHub commits API URL.
    • LAST_COMMIT_FILE — file to store last seen commit SHA (defaults to last_commit.txt).

Composer scripts

  • composer unit — run the test suite (phpunit).
  • composer cs — run PHP CS Fixer.
  • composer phpacker — build single-file binaries (non-interactive; platform baked into the script).

Testing

  • Tests live under tests/ and use PHPUnit. Run:
composer unit

Packaging notes

  • The phpacker build bundles a bootstrap (run.php) and the packaged binary expects to find a .env when executed; run.php searches upward from the current working directory so packaged binaries can locate the project .env.

Logging

  • The CLI uses Monolog and logs to php://stdout by default. To provide a custom logger, instantiate Valgorithms\DiscordChangelog\GitHubCommitWatcher directly and pass a PSR-3 LoggerInterface implementation.

Support

  • If you hit issues packaging or running the exe, ensure the build output contains the vendor/ folder or use run.php which is tolerant of layout.