Merge pull request #8932 from Rylan12/tap-new-add-branch-option

tap-new: add option for branch name
This commit is contained in:
Mike McQuaid 2020-10-16 08:37:45 +01:00 committed by GitHub
commit 7f422af789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View File

@ -17,8 +17,12 @@ module Homebrew
switch "--no-git",
description: "Don't initialize a git repository for the tap."
flag "--pull-label",
flag "--pull-label=",
description: "Label name for pull requests ready to be pulled (default `pr-pull`)."
flag "--branch=",
description: "Initialize git repository with the specified branch name (default `main`)."
conflicts "--no-git", "--branch"
named 1
end
end
@ -27,6 +31,7 @@ module Homebrew
args = tap_new_args.parse
label = args.pull_label || "pr-pull"
branch = args.branch || "main"
tap_name = args.named.first
tap = Tap.fetch(tap_name)
@ -56,7 +61,7 @@ module Homebrew
name: brew test-bot
on:
push:
branches: master
branches: #{branch}
pull_request:
jobs:
test-bot:
@ -106,7 +111,7 @@ module Homebrew
- labeled
jobs:
pr-pull:
if: contains(github.event.pull_request.labels.*.name, #{label})
if: contains(github.event.pull_request.labels.*.name, '#{label}')
runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
@ -125,6 +130,7 @@ module Homebrew
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ github.token }}
branch: #{branch}
- name: Delete branch
if: github.event.pull_request.head.repo.fork == false
@ -142,6 +148,7 @@ module Homebrew
safe_system "git", "init"
safe_system "git", "add", "--all"
safe_system "git", "commit", "-m", "Create #{tap} tap"
safe_system "git", "branch", "-m", branch
end
end

View File

@ -1233,6 +1233,8 @@ Generate the template files for a new tap.
Don't initialize a git repository for the tap.
* `--pull-label`:
Label name for pull requests ready to be pulled (default `pr-pull`).
* `--branch`:
Initialize git repository with the specified branch name (default `main`).
### `test` [*`options`*] *`formula`*

View File

@ -1712,6 +1712,10 @@ Don\'t initialize a git repository for the tap\.
\fB\-\-pull\-label\fR
Label name for pull requests ready to be pulled (default \fBpr\-pull\fR)\.
.
.TP
\fB\-\-branch\fR
Initialize git repository with the specified branch name (default \fBmain\fR)\.
.
.SS "\fBtest\fR [\fIoptions\fR] \fIformula\fR"
Run the test method provided by an installed formula\. There is no standard output or return code, but generally it should notify the user if something is wrong with the installed formula\.
.