Skip to content

batches: add button to automatically exclude repo in batch spec

Warren Gifford requested to merge kr/exclude-workspace-button into main

Created by: courier-new

PoC that adds a button to the workspaces preview list items to auto-update the batch spec code in the editor when a user wants to exclude a repo originally returned from the search results. Uses yaml-ast-parser to parse an AST from the batch spec, identify where to append -repo: and/or which repository: directive to remove, and manipulates the batch spec to exclude the desired repo/workspace.

It's pretty hackily implemented, and it's kinda janky since the workspaces preview UI takes a couple seconds to update and reflect the new workspaces without the one that was excluded, but it works!!

https://user-images.githubusercontent.com/8942601/133354872-fa9b489b-e6b1-4a86-99ae-cca6208d6a57.mov

Left a couple questions in the form of TODOs.

Also for the record, yaml-ast-parser looks to be abandoned, but it also has zero dependencies and seems to work pretty reliably, so I'm not too concerned about using it. But let me know if you feel otherwise.

Merge request reports

Loading