Skip to content

feat: add webhook-announcements shared workflow#219

Merged
fredbi merged 1 commit into
go-openapi:masterfrom
fredbi:feat/auto-announcements
Jun 21, 2026
Merged

feat: add webhook-announcements shared workflow#219
fredbi merged 1 commit into
go-openapi:masterfrom
fredbi:feat/auto-announcements

Conversation

@fredbi

@fredbi fredbi commented Jun 21, 2026

Copy link
Copy Markdown
Member

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.

Change type

Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update

Short description

Fixes

Full description

Checklist

  • I have signed all my commits with my name and email (see DCO. This does not require a PGP-signed commit
  • I have rebased and squashed my work, so only one commit remains
  • I have added tests to cover my changes.
  • I have properly enriched go doc comments in code.
  • I have properly documented any breaking change.

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

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f00f576) to head (20af8f5).
⚠️ Report is 7 commits behind head on master.
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

@fredbi fredbi merged commit f16ea07 into go-openapi:master Jun 21, 2026
35 checks passed
@fredbi fredbi deleted the feat/auto-announcements branch June 21, 2026 18:25
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