Scripting approach (Shell vs Python) for GitHub Actions

Scripting approach (Shell vs Python) for GitHub Actions

Purpose

The purpose of this SPIKE is to evaluate scripting approaches (Shell vs Python) for implementing automation workflows in GitHub Actions based on the application lifecycle pipelines defined in the attached diagrams.

We aim to:

  • Identify trade-offs between using Shell and Python for workflow tasks

  • Recommend the preferred scripting option (or hybrid) for long-term maintainability, team skill alignment, and DevEx (developer experience)

Context

The Kitfox team is creating CI workflows for Eureka applications and Eureka platform repositories in GitHub Actions. The automation involves:

  • Periodic scanning and updating of module versions

  • PR management and validation of application descriptors

  • Compatibility checks using mgr-applications

  • Publishing and tagging release metadata to S3/FAR

All flows are defined in diagrams (CI flow [release] CI flow [snapshot] ), involving:

  • YAML-based declarative GitHub Actions logic

  • External scripting for validation, descriptor processing, API calls, Slack notification, etc.

We must decide whether to implement these scripts in Shell (bash) or Python.

Evaluation Criteria

Criteria

Shell (bash)

Python

Criteria

Shell (bash)

Python

Availability in GitHub runners

Preinstalled

Preinstalled

Ease of authoring simple tasks

Simple syntax for small commands

Verbose for 1-liners

Complex logic / validation

Hard to maintain, no error handling

Structured, reusable, testable

Readability

Cryptic for non-CLI developers

Clean, readable

Tooling / dependencies

Uses native CLI tools

Might require pip or venv

Error handling

Manual (set -e, traps, etc.)

try/except, logging

Team familiarity

Mixed

Mixed

Future scaling

Tedious for larger flows

Suitable for expanding logic

Observations from Workflow Analysis

Flow Step

Scripting Needs

Recommendation

Flow Step

Scripting Needs

Recommendation

Module version comparison

Data parsing, comparison logic

Python

App descriptor generation & updates

JSON/YAML processing

Python

PR creation / status checks via GitHub API

HTTP requests, authentication

Python

Slack notifications

Webhooks, retries

Python

Increment version numbers

Simple arithmetic, text replace

Shell or Python

Commits

git, sed, echo, etc.

Shell

Descriptor uploads to S3/GitHub/FAR

CLI or SDK (boto3, etc.)

Python

Tagging releases

Git CLI

Shell

Recommendation

We recommend a hybrid approach:

Shell for

  • Lightweight Git operations (tagging, committing)

  • Simple string manipulation

  • Inline command wrappers (e.g., curl, sed, awk)

Python for

  • Data processing (JSON/YAML/XML parsing)

  • API interactions (GitHub, Slack, S3)

  • Descriptor generation and validation logic

  • Reusable logic between workflows

Organizing Python logic into a small internal CLI (e.g., python scripts/update_descriptors.py) ensures maintainability and allows for testing outside of GitHub runners.

Risks & Mitigations

Risk

Mitigation

Risk

Mitigation

Increased complexity with hybrid setup

Clear boundaries and README per script folder

Python dependency installation in Actions

Use setup-python action and requirements.txt

Conclusion

While Shell scripting is sufficient for basic operations, Python scripting provides scalability, clarity, and robustness for most logic-intensive parts of the workflow. A hybrid approach ensures the best of both worlds — balancing simplicity and control.