Skip to content

Commit 4d4afba

Browse files
committed
wip
1 parent ed666bf commit 4d4afba

16 files changed

Lines changed: 152787 additions & 24972 deletions

.github/workflows/self-test.yml

Lines changed: 175 additions & 151 deletions
Large diffs are not rendered by default.

.github/workflows/test-main-output.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/test-output-payload.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/test-poll-log-file.yml

Lines changed: 0 additions & 77 deletions
This file was deleted.

.github/workflows/test-post-output.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

HANDOFF.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ post.ts (action.yml post hook, runs always)
7070
├── Read final state
7171
├── Generate warnings
7272
├── Render summary to $GITHUB_STEP_SUMMARY + console
73-
└── Expose state_json and poll_log_json as action outputs
73+
└── Upload state.json + poll-log.json as diagnostics artifacts
7474
```
7575

7676
---
@@ -113,7 +113,7 @@ See `docs/planning/IMPL-PLAN-declarative-self-test.md` for full design.
113113

114114
## Next Steps
115115

116-
1. **Write README.md** — Usage examples, inputs/outputs reference, example summary output
116+
1. **Write README.md** — Usage examples, inputs/artifacts reference, example summary output
117117
2. **Increase test coverage** — poller lifecycle (20%), post.ts (0%), pre.ts (0%), poll-log.ts (0%)
118118
3. **Consider test isolation** — Dedicated repo or reserved token to avoid cross-workflow rate-limit noise
119119
4. **Consider adding**:
@@ -124,7 +124,7 @@ See `docs/planning/IMPL-PLAN-declarative-self-test.md` for full design.
124124

125125
## Resolved Questions
126126

127-
1. **Poller log file** — Resolved: poller writes diagnostic JSONL to `$RUNNER_TEMP/github-api-usage-monitor/poll-log.jsonl` via `poll-log.ts`. Exposed as `poll_log_json` action output.
127+
1. **Poller log file** — Resolved: poller writes diagnostic JSONL to `$RUNNER_TEMP/github-api-usage-monitor/poll-log.jsonl` via `poll-log.ts`. Post hook uploads `poll-log.json` as a diagnostics artifact alongside `state.json`.
128128

129129
2. **dist/ in repo** — Resolved: `dist/` is committed to git. Pre-commit hook verifies it stays in sync after `build:all`. CI also verifies.
130130

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,34 @@ The poller uses constant-space aggregation — it tracks per-bucket deltas acros
2828
|-------|----------|---------|-------------|
2929
| `token` | No | `${{ github.token }}` | GitHub token for API authentication |
3030

31-
## Outputs
31+
## Diagnostics artifacts
3232

33-
| Output | Description |
34-
|--------|-------------|
35-
| `state_json` | Finalized reducer state as a JSON string |
36-
| `poll_log_json` | Poll log entries as a JSON array string |
33+
The post hook uploads a per-job diagnostics artifact named `github-api-usage-monitor-${GITHUB_JOB}` that contains:
3734

38-
### Using outputs in downstream steps
35+
- `state.json` — finalized reducer state
36+
- `poll-log.json` — poll log entries as a JSON array
3937

40-
```yaml
41-
- uses: hesreallyhim/github-api-usage-monitor@main
42-
id: monitor
38+
### Using artifacts in downstream jobs
4339

44-
- name: Check usage
45-
run: |
46-
echo '${{ steps.monitor.outputs.state_json }}' | jq '.buckets.core.total_used'
40+
```yaml
41+
jobs:
42+
monitor:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: hesreallyhim/github-api-usage-monitor@main
46+
47+
diagnostics:
48+
runs-on: ubuntu-latest
49+
needs: monitor
50+
steps:
51+
- uses: actions/download-artifact@v4
52+
with:
53+
name: github-api-usage-monitor-monitor
54+
path: ./monitor-artifacts
55+
56+
- name: Check usage
57+
run: |
58+
jq '.buckets.core.total_used' ./monitor-artifacts/state.json
4759
```
4860

4961
## Example Summary Output

action.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,6 @@ inputs:
1212
required: false
1313
default: ${{ github.token }}
1414

15-
outputs:
16-
state_json:
17-
description: 'Finalized reducer state as a JSON string'
18-
poll_log_json:
19-
description: 'Poll log entries as a JSON array string'
20-
main_marker:
21-
description: 'Marker value set by the main step'
22-
post_marker:
23-
description: 'Marker value set by the post step'
24-
post_state_json_bytes:
25-
description: 'Byte length of state_json output (post)'
26-
post_poll_log_json_bytes:
27-
description: 'Byte length of poll_log_json output (post)'
28-
post_poll_log_entries:
29-
description: 'Poll log entry count observed in post'
30-
post_poll_log_path:
31-
description: 'Poll log file path observed in post'
32-
post_github_output_bytes:
33-
description: 'GITHUB_OUTPUT size in bytes observed in post (before size output write)'
34-
post_github_output_path:
35-
description: 'GITHUB_OUTPUT path observed in post'
36-
3715
runs:
3816
using: node20
3917
pre: dist/pre.js

0 commit comments

Comments
 (0)