pub fn workflow_dispatch_path_segment(name: &str) -> Option<String>Expand description
Normalize a user-facing workflow identifier into the path segment
GitHub’s workflow_dispatch endpoint expects as {workflow_file_name}
in /repos/{owner}/{repo}/actions/workflows/{workflow_file_name}/dispatches.
- Drops any directory prefix:
"release/prod.yml"→"prod.yml". - Preserves an existing
.ymlor.yamlsuffix so workflows stored as.yamldon’t have.ymltacked on. - Appends
.ymlwhen no extension is present so the result is always a valid filename reference. - Returns
Nonefor inputs with no extractable basename (empty string, bare path separator, trailing slash).
Used both by trigger_workflow to build the real dispatch URL
and by the TUI’s Trigger-tab curl preview via this crate’s public
API, so the preview and the actual POST land on the same endpoint.