Skip to content

Add `src actions exec` command to generate arbitrary campaign diffs

Warren Gifford requested to merge a8n/actions into master

Created by: sqs

Usage:

Run:

go install ./cmd/src && \
docker build -t sqs1/add-lsif-to-build-pipeline-action actions/add-lsif-to-build-pipeline && \
src actions exec -j 4 -keep-logs -f actions/add-lsif-to-build-pipeline/action.json  | \
  src campaign plan create-from-patches

image

This will create a campaign that adds GitHub Action LSIF build steps to repositories matched in the action.json file (see and change the query to match repositories that exist on your instance). Note: You should only use this with the test sd9 and sd9org repositories, because if you click the link and press Create, it will create PRs on real live repositories!

image

Ping me (@sqs) for help on anything here if you pick up this PR.

TODOs:

  • Format of action.json files and overall model for specifying what to run, which repositories to run it on, etc.
  • CLI UX (it's weird you need to pipe stuff)
  • Clean up code and add tests
  • Currently only works on Linux, needs to support macOS (the diff CLI flags we use only work on GNU diff not BSD diff, and the Docker volume mounting breaks due to macOS's /var/tmp/folders/... sandboxing)
  • Document (documentation & guide here: https://github.com/sourcegraph/sourcegraph/pull/8064 and also in the -help output of the commands)
  • The terminal library (that lets us print progress bars) does not properly handle colored text. If your terminal is too narrow, the progress bars "climb" up the screen. This is due to the terminal library thinking that a line has (for example) 80 chars but it only has (for example) 65 visible chars plus 15 ANSI escape sequence chars for colors. This appears to be a problem in all Go terminal libs. I started to make my own to fix this on a flight w/o WiFi; if it would be helpful, remind me to push it up.
  • The proposed src campaigns create command is not implemented
  • Remove sample actions in the actions/ dir. These are good candidates for examples in the docs, but they don't belong in this repo.

Merge request reports

Loading