Skip to content

refactor(webhook): add persistent keys in logs - #5030

Merged
npalm merged 2 commits into
github-aws-runners:mainfrom
edersonbrilhante:feat-log-persistent-keys
Mar 10, 2026
Merged

refactor(webhook): add persistent keys in logs#5030
npalm merged 2 commits into
github-aws-runners:mainfrom
edersonbrilhante:feat-log-persistent-keys

Conversation

@edersonbrilhante

Copy link
Copy Markdown
Contributor

Summary

Update publishOnEventBridge to use the existing readEvent helper instead of directly reading the x-github-event header and calling checkEventIsSupported.

Only eventType is destructured from readEvent, since the parsed event object isn’t needed.

Why

This makes the EventBridge path consistent with publishForRunners, ensuring persistent logging fields (repository, action, workflow job name, status, etc.) are added to the logger in both code paths.

Impact

  • No functional changes
  • Consistent logging behavior
  • Removes duplicate event parsing logic

@edersonbrilhante edersonbrilhante changed the title feat: add persistent keys in logs feat(publishOnEventBridge): add persistent keys in logs Feb 13, 2026
@edersonbrilhante
edersonbrilhante marked this pull request as ready for review February 13, 2026 10:54
@edersonbrilhante
edersonbrilhante requested a review from a team as a code owner February 13, 2026 10:54
@edersonbrilhante
edersonbrilhante force-pushed the feat-log-persistent-keys branch 2 times, most recently from 8b62efd to 9467eeb Compare March 6, 2026 23:11
@npalm
npalm requested a review from Copilot March 9, 2026 20:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the webhook EventBridge publishing path to reuse the shared readEvent helper so that persistent GitHub-related logging fields are populated consistently across webhook handlers.

Changes:

  • Pass allowedEvents into readEvent and reuse it from publishOnEventBridge instead of directly reading headers + calling checkEventIsSupported.
  • Update publishForRunners to call the new readEvent signature with an explicit ['workflow_job'] allow-list.
  • Refactor readEvent to accept an allowedEvents parameter and use it for event-type validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lambdas/functions/webhook/src/webhook/index.ts
Comment thread lambdas/functions/webhook/src/webhook/index.ts

@npalm npalm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edersonbrilhante pr looks good, but the title is a bit cryptic to me. Would call it refactor(webhook): ...

@edersonbrilhante edersonbrilhante changed the title feat(publishOnEventBridge): add persistent keys in logs refactor(webhook): add persistent keys in logs Mar 9, 2026
@edersonbrilhante

Copy link
Copy Markdown
Contributor Author

I changed the title. I didn't see as a refactor, more like a small change to use same payload in log for call using eventbridge or direct events

@edersonbrilhante
edersonbrilhante force-pushed the feat-log-persistent-keys branch from a66f251 to 5c3eaee Compare March 9, 2026 20:56
@edersonbrilhante
edersonbrilhante requested a review from npalm March 10, 2026 13:15
@npalm
npalm merged commit 1f9805d into github-aws-runners:main Mar 10, 2026
8 checks passed
@edersonbrilhante
edersonbrilhante deleted the feat-log-persistent-keys branch March 10, 2026 17:49
Brend-Smits pushed a commit that referenced this pull request Mar 11, 2026
## Summary

Update `publishOnEventBridge` to use the existing `readEvent` helper
instead of directly reading the `x-github-event` header and calling
`checkEventIsSupported`.

Only `eventType` is destructured from `readEvent`, since the parsed
event object isn’t needed.

## Why

This makes the EventBridge path consistent with `publishForRunners`,
ensuring persistent logging fields (repository, action, workflow job
name, status, etc.) are added to the logger in both code paths.

## Impact

* No functional changes
* Consistent logging behavior
* Removes duplicate event parsing logic
Brend-Smits pushed a commit that referenced this pull request Apr 1, 2026
## Summary

Update `publishOnEventBridge` to use the existing `readEvent` helper
instead of directly reading the `x-github-event` header and calling
`checkEventIsSupported`.

Only `eventType` is destructured from `readEvent`, since the parsed
event object isn’t needed.

## Why

This makes the EventBridge path consistent with `publishForRunners`,
ensuring persistent logging fields (repository, action, workflow job
name, status, etc.) are added to the logger in both code paths.

## Impact

* No functional changes
* Consistent logging behavior
* Removes duplicate event parsing logic
LudovicTOURMAN pushed a commit to doctolib-lab/terraform-aws-github-runner that referenced this pull request Apr 7, 2026
## Summary

Update `publishOnEventBridge` to use the existing `readEvent` helper
instead of directly reading the `x-github-event` header and calling
`checkEventIsSupported`.

Only `eventType` is destructured from `readEvent`, since the parsed
event object isn’t needed.

## Why

This makes the EventBridge path consistent with `publishForRunners`,
ensuring persistent logging fields (repository, action, workflow job
name, status, etc.) are added to the logger in both code paths.

## Impact

* No functional changes
* Consistent logging behavior
* Removes duplicate event parsing logic
Brend-Smits added a commit that referenced this pull request Jun 10, 2026
## Description

Rollback changes introduced on #5030. The webhook lambda in the
EventBridge mode is not supporting other events beside `workflow_job`.

## Related Issues

This PR fixes #5142.

---------

Co-authored-by: Brend Smits <brend.smits@philips.com>
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.

3 participants