feat: add webhook-announcements shared workflow#219
Merged
Conversation
Add a reusable workflow that watches a markdown file's "## Announcements"
section on the default branch and posts each newly added announcement to a
webhook (Discord by default), one message per announcement.
How it works:
- Diffs the full pushed range (github.event.before..github.sha), isolates the
"## Announcements" section in both blobs, and treats a block as new when its
normalized first-line key is present in the after blob but not the before
one. README edits outside the section, or re-runs over an overlapping range,
detect zero new blocks and post nothing (idempotent, no reposts).
- Each announcement's first bullet line becomes the embed title
("DATE: summary", stripped of markdown); its sub-bullets become the embed
description. Embeds link to the README #announcements anchor.
- Default secret is DISCORD_ANNOUNCEMENTS_WEBHOOK_URL, overridable via the
explicit webhook-url secret (no secrets[inputs.x] keyed access).
A compare-base input overrides the diff base; passing the git empty-tree SHA
treats every current announcement as new, which enables manual testing and
backfilling.
Also add local-webhook-announcements.yml plus a committed fixture: pushes that
touch the fixture run in forced dry-run (payloads printed, never posted) to
exercise detection safely, while workflow_dispatch runs a manual live test
against an arbitrary webhook URL.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #219 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 14 14
=========================================
Hits 14 14 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a reusable workflow that watches a markdown file's "## Announcements" section on the default branch and posts each newly added announcement to a webhook (Discord by default), one message per announcement.
How it works:
A compare-base input overrides the diff base; passing the git empty-tree SHA treats every current announcement as new, which enables manual testing and backfilling.
Also add local-webhook-announcements.yml plus a committed fixture: pushes that touch the fixture run in forced dry-run (payloads printed, never posted) to exercise detection safely, while workflow_dispatch runs a manual live test against an arbitrary webhook URL.
Change type
Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update
Short description
Fixes
Full description
Checklist