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.phpBootstrap helper
run.phpis the project's bootstrap. It searches parent directories for a.envand ensureslast_commit.txtexists; run it withphp run.php.
Configuration
- Environment variables are defined in
.env(see .env.example).DISCORD_WEBHOOK— your Discord webhook URL (don't leave asCHANGEME).GITHUB_REPO_API— GitHub commits API URL.LAST_COMMIT_FILE— file to store last seen commit SHA (defaults tolast_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 unitPackaging notes
- The
phpackerbuild bundles a bootstrap (run.php) and the packaged binary expects to find a.envwhen executed;run.phpsearches upward from the current working directory so packaged binaries can locate the project.env.
Logging
- The CLI uses Monolog and logs to
php://stdoutby default. To provide a custom logger, instantiateValgorithms\DiscordChangelog\GitHubCommitWatcherdirectly and pass a PSR-3LoggerInterfaceimplementation.
Support
- If you hit issues packaging or running the exe, ensure the build output
contains the
vendor/folder or userun.phpwhich is tolerant of layout.