Git & GitHub Interview Question #106
What is a composite action in GitHub Actions?
Advanced GitHub Actions, Repository Internals, Submodules, LFS & Diagnostic Tools Senior Advanced
Quick Interview Answer
A composite action packages multiple workflow steps into a reusable action. It is useful when the same sequence of shell commands or actions must be reused without defining an entire reusable workflow.
Detailed Explanation
A composite action packages multiple workflow steps into a reusable action. It is useful when the same sequence of shell commands or actions must be reused without defining an entire reusable workflow.
Composite actions are typically stored with an action.yml metadata file. They are different from reusable workflows because they operate as a step inside a job rather than defining complete jobs and workflow-level orchestration.
Code Example
# .github/actions/setup-app/action.yml
name: Setup App
runs:
using: composite
steps:
- shell: bash
run: echo "Set up application"
# Workflow usage:
# - uses: ./.github/actions/setup-app