Skip to content

Commit

Permalink
Merge branch 'main' into pr-status
Browse files Browse the repository at this point in the history
  • Loading branch information
catscanner authored Mar 28, 2023
2 parents 619d034 + d427d49 commit 3769515
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ jobs:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,15 @@ archives:
amd64: x86_64
checksum:
name_template: 'checksums.txt'
brews:
- name: turbolift
description: Simple tool to help apply changes across many GitHub repositories simultaneously
homepage: https://github.com/Skyscanner/turbolift
license: Apache-2.0
tap:
owner: Skyscanner
name: homebrew-tools
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
dependencies:
- name: gh

21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ It's dumb but it works. It doesn't scale well, though. Manually cloning and rais
Turbolift essentially automates the boring parts and stays out of the way when it comes to actually making the changes. It automates cloning, committing, and raising PRs en-masse, so that you can focus on the substance of the change.

> Historical note: Turbolift supersedes an internal system at Skyscanner named Codelift. Codelift was a centralised batch system, requiring changes to be scripted upfront and run overnight. While Codelift was useful, we have found that a decentralised, interactive tool is far easier and quicker for people to use in practice.
>
> [This blog post](https://medium.com/@SkyscannerEng/turbolift-a-tool-for-refactoring-at-scale-70603314f7cc) gives a longer background for the thinking behind Turbolift.
## Demo

Expand All @@ -20,7 +22,20 @@ This demo shows Turbolift in action, creating a simple PR in two repositories:

## Installation

### Downloading binaries
<details>
<summary>Using brew (recommended)</summary>
Install turbolift using brew from Skyscanner's tap, as follows:

```shell
brew install skyscanner/tools/turbolift
```

Note that the GitHub CLI, `gh` is a dependency of Turbolift and will be installed automatically.

</details>

<details>
<summary>Downloading binaries</summary>

Pre-built binary archives can be downloaded from the [Releases](https://github.com/Skyscanner/turbolift/releases) page.

Expand All @@ -30,7 +45,9 @@ Pre-built binary archives can be downloaded from the [Releases](https://github.c
You must also have the GitHub CLI, `gh`, installed:

* Install using `brew install gh`
* Before using Turbolift, run `gh auth login` once and follow the prompts, to authenticate against github.com and/or your GitHub Enterprise server.
</details>

> Before using Turbolift, run `gh auth login` once and follow the prompts, to authenticate against github.com and/or your GitHub Enterprise server.
## Basic usage:

Expand Down
13 changes: 8 additions & 5 deletions cmd/clone/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ import (
"os"
"path"

"github.com/spf13/cobra"

"github.com/skyscanner/turbolift/internal/campaign"
"github.com/skyscanner/turbolift/internal/colors"
"github.com/skyscanner/turbolift/internal/git"
"github.com/skyscanner/turbolift/internal/github"
"github.com/skyscanner/turbolift/internal/logging"
"github.com/spf13/cobra"
)

var gh github.GitHub = github.NewRealGitHub()
var g git.Git = git.NewRealGit()
var (
gh github.GitHub = github.NewRealGitHub()
g git.Git = git.NewRealGit()
)

var nofork bool

Expand Down Expand Up @@ -66,7 +69,7 @@ func run(c *cobra.Command, _ []string) {
cloneActivity = logger.StartActivity("Forking and cloning %s into %s/%s", repo.FullRepoName, orgDirPath, repo.RepoName)
}

err := os.MkdirAll(orgDirPath, os.ModeDir|0755)
err := os.MkdirAll(orgDirPath, os.ModeDir|0o755)
if err != nil {
cloneActivity.EndWithFailuref("Unable to create org directory: %s", err)
errorCount++
Expand Down Expand Up @@ -115,7 +118,7 @@ func run(c *cobra.Command, _ []string) {
}
logger.Println("To continue:")
logger.Println("\t1. Make your changes in the cloned repositories within the", colors.Cyan("work"), "directory")
logger.Println("\t2. Add new files across all repos using", colors.Cyan(`turbolift foreach -- git add -A`))
logger.Println("\t2. Add new files across all repos using", colors.Cyan(`turbolift foreach git add -A`))
logger.Println("\t3. Commit changes across all repos using", colors.Cyan(`turbolift commit --message "Your commit message"`))
logger.Println("\t4. Change the PR title and description in the", colors.Cyan(`README.md`), "of a campaign")
}
9 changes: 5 additions & 4 deletions cmd/foreach/foreach.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@
package foreach

import (
"os"
"path"
"strings"

"github.com/skyscanner/turbolift/internal/campaign"
"github.com/skyscanner/turbolift/internal/colors"
"github.com/skyscanner/turbolift/internal/executor"
"github.com/skyscanner/turbolift/internal/logging"
"github.com/spf13/cobra"
"os"
"path"
"strings"
)

var exec executor.Executor = executor.NewRealExecutor()

func NewForeachCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "foreach -- SHELL_COMMAND",
Use: "foreach SHELL_COMMAND",
Short: "Run a shell command against each working copy",
Run: run,
Args: cobra.MinimumNArgs(1),
Expand Down

0 comments on commit 3769515

Please sign in to comment.