From 062981ae8abe32d85f1eff9c5031a874aaa7fd37 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Fri, 7 Apr 2023 14:50:41 +1000 Subject: [PATCH] Add support for `--no-fork` --- README.md | 2 ++ action.yml | 5 +++++ main.rb | 3 +++ 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 88323c7..652e08e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ The Action will extract all needed informations by itself, you just need to spec token: ${{secrets.TOKEN}} # Optional, will create tap repo fork in organization org: ORG + # Optional, use the origin repository instead of forking + no_fork: false # Optional, defaults to homebrew/core tap: USER/REPO # Formula name, required diff --git a/action.yml b/action.yml index 2570ad6..8235d19 100644 --- a/action.yml +++ b/action.yml @@ -16,6 +16,10 @@ inputs: description: | Fork tap repository to selected GitHub organization. required: false + no_fork: + description: | + Use the origin repository instead of forking. + required: false tap: description: | Formula tap. @@ -81,6 +85,7 @@ runs: HOMEBREW_GITHUB_API_TOKEN: ${{inputs.token}} HOMEBREW_BUMP_MESSAGE: ${{inputs.message}} HOMEBREW_BUMP_ORG: ${{inputs.org}} + HOMEBREW_BUMP_NO_FORK: ${{inputs.no_fork}} HOMEBREW_BUMP_TAP: ${{inputs.tap}} HOMEBREW_BUMP_FORMULA: ${{inputs.formula}} HOMEBREW_BUMP_TAG: ${{inputs.tag}} diff --git a/main.rb b/main.rb index 9a76e89..1139572 100644 --- a/main.rb +++ b/main.rb @@ -41,6 +41,7 @@ def read_brew(*args) # Get inputs message = ENV['HOMEBREW_BUMP_MESSAGE'] org = ENV['HOMEBREW_BUMP_ORG'] + no_fork = ENV['HOMEBREW_BUMP_NO_FORK'] tap = ENV['HOMEBREW_BUMP_TAP'] formula = ENV['HOMEBREW_BUMP_FORMULA'] tag = ENV['HOMEBREW_BUMP_TAG'] @@ -106,6 +107,7 @@ def read_brew(*args) '--no-browse', "--message=#{message}", *("--fork-org=#{org}" unless org.blank?), + *("--no-fork" unless no_fork.false?), *("--version=#{version}" unless is_git), *("--tag=#{tag}" if is_git), *("--revision=#{revision}" if is_git), @@ -149,6 +151,7 @@ def read_brew(*args) "--message=#{message}", "--version=#{version}", *("--fork-org=#{org}" unless org.blank?), + *("--no-fork" unless no_fork.false?), *('--force' unless force.false?), formula rescue ErrorDuringExecution => e