Skip to content
Latchkey

How to Emit Annotations From a Custom Action

A custom action surfaces problems by printing ::error:: workflow commands or calling core.error.

Print ::error::message (or ::warning::, ::notice::) from a shell step, or call core.error from JavaScript. Annotations appear in the run summary and can point at a file and line.

Steps

  • Print ::error file=...,line=...::message from a shell step.
  • Or call core.error, core.warning, core.notice in JavaScript.
  • Pair ::error:: with exit 1 to also fail the step.

Composite annotation

action.yml
run: |
  echo "::error file=src/app.js,line=42::Type check failed"
  echo "::warning::Deprecated flag in use"
  exit 1
shell: bash

JavaScript annotation

index.js
const core = require('@actions/core');
core.error('Type check failed', { file: 'src/app.js', startLine: 42 });
core.setFailed('Build failed');

Gotchas

  • ::error:: alone does not fail the step; add exit 1 or core.setFailed.
  • Annotation counts per run are capped, so group related messages.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →