Skip to content

sg: add an auto update mechanism

Administrator requested to merge devx/sg-auto-update into main

Created by: jhchabran

Introduces a new subcommand sg update auto enable to turn on automatic updates. It's turned off by default.

When turned on, sg will first check in its local copy of origin/main if there are new commits. If yes, it will execute sg update and restart itself with the same arguments, transparently running the given arguments to the freshly updated sg and requiring no action from the user.

CleanShot 2022-03-15 at 12 54 23

Fixes #29619 (closed)

Test plan

  1. Replaced the update check with main instead of origin/main
  2. Manually compiled sg with my changes
  3. Ran sg update auto enable
  4. Ran sg ci preview
    • Got an update triggered
    • Still got the output with from sg ci preview

See the gif in the above description.

Merge request reports

Loading