Reusable Status Step Action (action.yml)
This page documents the centralized composite GitHub Action used to emit:
- GitHub Actions annotations (notice/error)
- A consistent line in Step Summary (
$GITHUB_STEP_SUMMARY)
It is designed to be checked out early in each job (into a local folder like .ci-actions) and then used via a local uses: path.
Where this file lives (from the screenshot)
GitHub Organization: ts-001-org
Repository: ts-ci-actions (private)
Branch: main
Full file path in repo:
ts-001-org/ts-ci-actions/.github/actions/status-step/action.yml
Inside the repo, the folder structure is:
.github/
actions/
status-step/
action.yml
How service pipelines reference this action
Typical pattern in a service repo workflow:
- Checkout the centralized actions repo into
.ci-actions - Use the local action path from that checkout
Example:
- name: Checkout centralized CI actions repo
uses: actions/checkout@v4
with:
repository: ts-001-org/ts-ci-actions
ref: main
path: .ci-actions
token: ${{ steps.app-token.outputs.token }}
- name: Status - Example
if: always()
uses: ./.ci-actions/.github/actions/status-step
with:
step_name: "Checkout shared repo"
outcome: ${{ steps.checkout_shared.outcome }}
context: "svc=ts-gw-srvc-002 env=dev sha=09139a1"
Important:
outcomemust come from a step that has anid:(example:id: checkout_shared) so you can referencesteps.checkout_shared.outcome.
# FILE (DROP-IN): .github/actions/status-step/action.yml
Copy and paste the following file exactly as-is into:
ts-001-org/ts-ci-actions/.github/actions/status-step/action.yml
# FILE (DROP-IN): .github/actions/status-step/action.yml
# Purpose: reusable status step with optional context suffix (svc/env/sha/etc.)
name: "Status Step"
description: "Standardized status notice + step summary line with optional context suffix"
inputs:
step_name:
description: "Human-friendly step name (e.g., 'Checkout shared repo')"
required: true
outcome:
description: "Outcome string from steps.<id>.outcome"
required: true
# Optional: appended to both the annotation message and step summary.
# Example: "svc=ts-gw-srvc-002 env=dev sha=09139a1"
context:
description: "Optional context suffix"
required: false
default: ""
# Optional: override titles/messages. If omitted, defaults are used.
success_title:
description: "Annotation title for success"
required: false
default: ""
success_message:
description: "Annotation message for success (without context suffix)"
required: false
default: ""
failure_title:
description: "Annotation title for failure"
required: false
default: ""
failure_message:
description: "Annotation message for failure (without context suffix)"
required: false
default: ""
runs:
using: "composite"
steps:
- shell: bash
run: |
set -euo pipefail
STEP_NAME="${{ inputs.step_name }}"
OUTCOME="${{ inputs.outcome }}"
CONTEXT="${{ inputs.context }}"
CONTEXT_SUFFIX=""
if [ -n "${CONTEXT}" ]; then
CONTEXT_SUFFIX=" | ${CONTEXT}"
fi
# Defaults (if caller doesn't provide overrides)
SUCCESS_TITLE_DEFAULT="🟢 ${STEP_NAME}"
SUCCESS_MSG_DEFAULT="🟢 ${STEP_NAME}: success"
FAILURE_TITLE_DEFAULT="🔴 ${STEP_NAME}"
FAILURE_MSG_DEFAULT="🔴 ${STEP_NAME}: failure (or cancelled)"
SUCCESS_TITLE="${{ inputs.success_title }}"
SUCCESS_MSG="${{ inputs.success_message }}"
FAILURE_TITLE="${{ inputs.failure_title }}"
FAILURE_MSG="${{ inputs.failure_message }}"
if [ -z "${SUCCESS_TITLE}" ]; then SUCCESS_TITLE="${SUCCESS_TITLE_DEFAULT}"; fi
if [ -z "${SUCCESS_MSG}" ]; then SUCCESS_MSG="${SUCCESS_MSG_DEFAULT}"; fi
if [ -z "${FAILURE_TITLE}" ]; then FAILURE_TITLE="${FAILURE_TITLE_DEFAULT}"; fi
if [ -z "${FAILURE_MSG}" ]; then FAILURE_MSG="${FAILURE_MSG_DEFAULT}"; fi
if [ "${OUTCOME}" = "success" ]; then
echo "::notice title=${SUCCESS_TITLE}::${SUCCESS_MSG}${CONTEXT_SUFFIX}"
echo "✅🟢 ${STEP_NAME}: success${CONTEXT_SUFFIX}" >> "$GITHUB_STEP_SUMMARY"
else
echo "::error title=${FAILURE_TITLE}::${FAILURE_MSG}${CONTEXT_SUFFIX}"
echo "❌🔴 ${STEP_NAME}: failure${CONTEXT_SUFFIX}" >> "$GITHUB_STEP_SUMMARY"
fi
Notes / Best Practices
- Always call this action with
if: always()so failures still produce a summary line. - Use a short, scannable context string, for example:
svc=ts-gw-srvc-002 env=dev sha=09139a1
- Keep the action repo private (as shown in your screenshot) and use a GitHub App token for cross-repo checkout when needed.