def generate_workflow()

in gateway/gateway.py [0:0]


def generate_workflow(actions: ActionsYAML) -> str:
    """
    Generate a GitHub workflow file as a string from the actions.yml dictionary.

    Args:
        actions: Dictionary of actions and their references

    Returns:
        str: Generated workflow file content
    """
    # Github Workflow 'yaml' has slight deviations from the yaml spec. (e.g. keys with no values)
    # Because of that it's much easier to generate this as a string rather
    # then use pyyaml to dump this from a dict.
    header = """name: Dummy Workflow

on:
  workflow_dispatch:

jobs:
  dummy:
    if: false
    runs-on: ubuntu-latest
    steps:
"""
    steps = []
    steps.extend(
        f"      - uses: {name}@{ref}"
        for name, refs in actions.items()
        for ref, details in refs.items()
        # exclude actions that entered expiry range, use gt to also exclude actions that were expired today.
        if details["expires_at"] > calculate_expiry()
        and not details.get("keep")  # Exclude refs with "keep"
    )

    return header + "\n".join(steps)