Part of plan #15. Phase 7 — Observability & Logging.
Problem
Current logs are ad-hoc core.info('message with interpolated ${value}') strings. When a runner start / stop fails in a consumer's pipeline, debugging requires:
- Reading the raw Actions run log.
- Correlating a failure in this action's output with AWS-side events (CloudTrail, EC2 console).
- Guessing what region / account / instance type / SG the action actually used.
Target
Emit structured JSON lines at notable events. Each line includes:
step: one of describe_image, run_instance, wait_for_instance, gh_registration_token, wait_for_runner, terminate_instance, remove_runner.
mode: start or stop.
instance_id where applicable.
ami_id where applicable.
label.
- Duration when applicable (
elapsed_ms).
error object on failures ({name, code, message}).
Example:
::notice::{"step":"run_instance","mode":"start","instance_type":"t3.medium","ami_id":"ami-0f87d97680f97c222","subnet_id":"subnet-01c4ff5a","sg_id":"sg-106ec76d"}
::notice::{"step":"run_instance","mode":"start","instance_id":"i-02317df7bd1d30105","elapsed_ms":3140}
Proposed changes
- Helper
log(step, fields) in src/index.js that serializes {step, mode, ...fields} to JSON and forwards to core.info.
- Replace ad-hoc
console.log / core.info calls in src/aws.js and src/gh.js with log() calls.
- New optional input
debug: false. When true, also log input parameters (sanitized — no token values) and full AWS SDK responses.
core.startGroup('start-runner') / endGroup() around logical phases so the Actions run log collapses nicely.
Compatibility with consumers
Transparent. Log format changes but consumers don't scrape it programmatically.
Acceptance criteria
Part of plan #15. Phase 7 — Observability & Logging.
Problem
Current logs are ad-hoc
core.info('message with interpolated ${value}')strings. When a runner start / stop fails in a consumer's pipeline, debugging requires:Target
Emit structured JSON lines at notable events. Each line includes:
step: one ofdescribe_image,run_instance,wait_for_instance,gh_registration_token,wait_for_runner,terminate_instance,remove_runner.mode:startorstop.instance_idwhere applicable.ami_idwhere applicable.label.elapsed_ms).errorobject on failures ({name, code, message}).Example:
Proposed changes
log(step, fields)insrc/index.jsthat serializes{step, mode, ...fields}to JSON and forwards tocore.info.console.log/core.infocalls insrc/aws.jsandsrc/gh.jswithlog()calls.debug: false. Whentrue, also log input parameters (sanitized — no token values) and full AWS SDK responses.core.startGroup('start-runner')/endGroup()around logical phases so the Actions run log collapses nicely.Compatibility with consumers
Transparent. Log format changes but consumers don't scrape it programmatically.
Acceptance criteria
debuginput (defaultfalse) adds verbose diagnostic output.