Add telemetry status reporting to upload-code-coverage Action#15
Open
akream wants to merge 3 commits into
Open
Add telemetry status reporting to upload-code-coverage Action#15akream wants to merge 3 commits into
akream wants to merge 3 commits into
Conversation
Instrument the action to report status to the monolith endpoint at
start and end of execution, following the CodeQL Action pattern.
- Add status_report.py: telemetry module calling
PUT /repos/{repo}/code-coverage/action/status with action metadata,
runner info, timing, payload size, outcome, workflow & git context
- Instrument upload_coverage.py: send 'starting' report at entry,
'success'/'failure'/'user-error' at exit with duration and error info
- Add post_upload_coverage.py: post step that sends 'aborted' if main
step didn't report completion (cancelled/crashed workflows)
- Update action.yml: add always-run post step for telemetry
- Add test_status_report.py with full coverage of the new module
- Update test_upload_coverage.py with telemetry integration tests
- Update CI to run new test file
Telemetry never causes the action to fail - all calls are wrapped in
try/catch with 30s timeout and failures logged as warnings.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds telemetry status reporting to the upload-code-coverage composite Action, emitting a “starting” report at entry and a terminal status (“success”/“failure”/“user-error”), plus a post-step fallback intended to report “aborted” when the main step doesn’t complete. It also introduces unit tests for the new telemetry module and integrates telemetry assertions into existing upload tests.
Changes:
- Add
status_report.pyto build/send telemetry payloads and persist Action state for a post step. - Instrument
upload_coverage.pyto send telemetry at start and completion, including timing and payload size. - Add
post_upload_coverage.pyand wire it intoaction.ymlas analways()post step; update CI to run the new tests.
Show a summary per file
| File | Description |
|---|---|
| upload_coverage.py | Adds telemetry start/completion reporting and persists state for post-step behavior. |
| status_report.py | Implements telemetry report construction, HTTP PUT sender, and state helpers. |
| post_upload_coverage.py | Adds post-step script intended to emit “aborted” when main step didn’t complete. |
| action.yml | Adds an always-run post step for telemetry. |
| test_upload_coverage.py | Adds integration-style tests asserting telemetry calls and payload fields. |
| test_status_report.py | Adds unit tests for telemetry report building/sending and state helpers. |
| .github/workflows/ci.yml | Runs the new telemetry test module in CI. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 7/7 changed files
- Comments generated: 7
- Persist started_at and starting_report to state immediately so the post step has full context even if main exits early - Only set status_sent when send_status_report() returns True - Check HTTP response code in send_status_report(); treat non-2xx as failure and return False - Fix action_oid to resolve symbolic refs and validate 40-hex SHA - Rework post step to retry saved completed_report, or build aborted report from saved starting_report (no private helper calls) - Add input env vars to post step in action.yml - Add test_post_upload_coverage.py with 5 tests for post step logic Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Actions are downloaded as tarballs — there's no .git directory at GITHUB_ACTION_PATH. The CodeQL action also hardcodes action_oid as 'unknown'. We already capture GITHUB_ACTION_REF as action_ref which provides the version the caller specified. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Instrument the action to report status to the monolith endpoint at start and end of execution, following the CodeQL Action pattern.
Telemetry never causes the action to fail - all calls are wrapped in try/catch with 30s timeout and failures logged as warnings.
The monolith PR to enable the endpoint is now merged an has been verified: https://github.com/github/github/pull/436372
Splunk log