├── .github ├── dependabot.yml └── workflows │ ├── close-pr.yml │ └── test.yml ├── Formula ├── test-formula-git-revision.rb ├── test-formula-pypi-url.rb └── test-formula-url.rb ├── LICENSE ├── README.md ├── action.yml ├── bump-formula-pr.rb.patch └── main.rb /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "04:00" 8 | pull-request-branch-name: 9 | separator: "-" 10 | open-pull-requests-limit: 10 11 | -------------------------------------------------------------------------------- /.github/workflows/close-pr.yml: -------------------------------------------------------------------------------- 1 | name: Close Pull Request 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - opened 7 | paths: 8 | - "Formula/*.rb" 9 | 10 | concurrency: 11 | group: close-pr 12 | cancel-in-progress: false 13 | 14 | jobs: 15 | close-pr: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v4 20 | 21 | - name: Delete 22 | run: git push origin --delete ${{github.event.pull_request.head.ref}} 23 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test Action 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths-ignore: 8 | - README.md 9 | workflow_dispatch: 10 | 11 | concurrency: 12 | group: test 13 | cancel-in-progress: false 14 | 15 | jobs: 16 | test: 17 | strategy: 18 | matrix: 19 | include: 20 | - formula: test-formula-url 21 | tag: v0.1.12 22 | - formula: test-formula-git-revision 23 | tag: v0.3.3 24 | revision: c43abd765cf51c06bbcaa5479dc49aab1396989f 25 | - formula: test-formula-pypi-url 26 | tag: v2.42.0 27 | runs-on: ubuntu-latest 28 | steps: 29 | - name: Checkout 30 | uses: actions/checkout@v4 31 | 32 | - name: Test 33 | uses: ./ 34 | with: 35 | token: ${{secrets.TOKEN}} 36 | tap: ${{github.repository}} 37 | tap_url: ${{github.server_url}}/${{github.repository}} 38 | formula: ${{matrix.formula}} 39 | tag: ${{matrix.tag}} 40 | revision: ${{matrix.revision}} 41 | force: true 42 | test-livecheck-formula: 43 | runs-on: macos-latest 44 | needs: 45 | - test 46 | steps: 47 | - name: Wait 48 | run: sleep 30 49 | 50 | - name: Checkout 51 | uses: actions/checkout@v4 52 | 53 | - name: Test 54 | uses: ./ 55 | with: 56 | token: ${{secrets.TOKEN}} 57 | message: test 58 | formula: | 59 | test-formula-url 60 | test-formula-git-revision 61 | test-formula-pypi-url 62 | tap: ${{github.repository}} 63 | tap_url: ${{github.server_url}}/${{github.repository}} 64 | livecheck: true 65 | force: true 66 | test-livecheck-tap: 67 | runs-on: ubuntu-latest 68 | needs: 69 | - test-livecheck-formula 70 | steps: 71 | - name: Wait 72 | run: sleep 30 73 | 74 | - name: Checkout 75 | uses: actions/checkout@v4 76 | 77 | - name: Test 78 | uses: ./ 79 | with: 80 | token: ${{secrets.TOKEN}} 81 | message: | 82 | First line 83 | SECOND LINE 84 | tap: ${{github.repository}} 85 | tap_url: ${{github.server_url}}/${{github.repository}} 86 | livecheck: true 87 | force: true 88 | -------------------------------------------------------------------------------- /Formula/test-formula-git-revision.rb: -------------------------------------------------------------------------------- 1 | class TestFormulaGitRevision < Formula 2 | desc "Formula to test Action" 3 | homepage "https://github.com/Debian/dh-make-golang" 4 | url "https://github.com/Debian/dh-make-golang.git", 5 | tag: "v0.3.2", 6 | revision: "82916c0d56b6319398f635199222dff397fafc12" 7 | license "MIT" 8 | head "https://github.com/Debian/dh-make-golang.git" 9 | 10 | def install 11 | (buildpath/"test").write <<~EOS 12 | test 13 | EOS 14 | 15 | share.install "test" 16 | end 17 | 18 | test do 19 | sleep 1 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /Formula/test-formula-pypi-url.rb: -------------------------------------------------------------------------------- 1 | class TestFormulaPypiUrl < Formula 2 | include Language::Python::Virtualenv 3 | 4 | desc "Formula to test Action" 5 | homepage "https://commitizen-tools.github.io/commitizen/" 6 | url "https://files.pythonhosted.org/packages/a1/14/3ad1772b81f1e2f7c91ac99987c0ac72a50ebe2a06967cf9a3eea81dd0d0/commitizen-2.14.0.tar.gz" 7 | sha256 "afc68d9d61c8338beeb6145a8276e97a342a16f4f721c8ff654403043240cec0" 8 | license "MIT" 9 | head "https://github.com/commitizen-tools/commitizen.git" 10 | 11 | depends_on "python@3.9" 12 | 13 | resource "argcomplete" do 14 | url "https://files.pythonhosted.org/packages/cb/53/d2e3d11726367351b00c8f078a96dacb7f57aef2aca0d3b6c437afc56b55/argcomplete-1.12.2.tar.gz" 15 | sha256 "de0e1282330940d52ea92a80fea2e4b9e0da1932aaa570f84d268939d1897b04" 16 | end 17 | 18 | resource "colorama" do 19 | url "https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz" 20 | sha256 "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b" 21 | end 22 | 23 | resource "decli" do 24 | url "https://files.pythonhosted.org/packages/9f/30/064f53ca7b75c33a892dcc4230f78a1e01bee4b5b9b49c0be1a61601c9bd/decli-0.5.2.tar.gz" 25 | sha256 "f2cde55034a75c819c630c7655a844c612f2598c42c21299160465df6ad463ad" 26 | end 27 | 28 | resource "Jinja2" do 29 | url "https://files.pythonhosted.org/packages/4f/e7/65300e6b32e69768ded990494809106f87da1d436418d5f1367ed3966fd7/Jinja2-2.11.3.tar.gz" 30 | sha256 "a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6" 31 | end 32 | 33 | resource "MarkupSafe" do 34 | url "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz" 35 | sha256 "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b" 36 | end 37 | 38 | resource "packaging" do 39 | url "https://files.pythonhosted.org/packages/86/3c/bcd09ec5df7123abcf695009221a52f90438d877a2f1499453c6938f5728/packaging-20.9.tar.gz" 40 | sha256 "5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5" 41 | end 42 | 43 | def install 44 | (buildpath/"test").write <<~EOS 45 | test 46 | EOS 47 | 48 | share.install "test" 49 | end 50 | 51 | test do 52 | sleep 1 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /Formula/test-formula-url.rb: -------------------------------------------------------------------------------- 1 | class TestFormulaUrl < Formula 2 | desc "Formula to test Action" 3 | homepage "https://github.com/dawidd6/actions-updater" 4 | url "https://github.com/dawidd6/actions-updater/archive/v0.1.11.tar.gz" 5 | sha256 "b1c83ee9d19289eb403ad0863c235fa9c3b3a980c9b13a43cda9fc9413935df4" 6 | license "MIT" 7 | 8 | def install 9 | (buildpath/"test").write <<~EOS 10 | test 11 | EOS 12 | 13 | share.install "test" 14 | end 15 | 16 | test do 17 | sleep 1 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Dawid Dziurla 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Homebrew bump formula GitHub Action 2 | 3 | An action that wraps `brew bump-formula-pr` to ease the process of updating the formula on new project releases. 4 | 5 | Works on Ubuntu and macOS runners. 6 | 7 | ## Usage 8 | 9 | One should use the [Personal Access Token](https://github.com/settings/tokens/new?scopes=public_repo,workflow) for `token` input to this Action, not the default `GITHUB_TOKEN`, because `brew bump-formula-pr` creates a fork of the formula's tap repository (if needed) and then creates a pull request. 10 | 11 | > There are two ways to use this Action. 12 | 13 | ### Standard mode 14 | 15 | Use if you want to simply bump the formula, when a new release happens. 16 | 17 | Listen for new tags in workflow: 18 | 19 | ```yaml 20 | on: 21 | # trigger when release got created (preferred) 22 | release: 23 | types: [released] 24 | # trigger on tag push 25 | # push: 26 | # tags: 27 | # - "*" 28 | ``` 29 | 30 | The Action will extract all needed informations by itself, you just need to specify the following step in your workflow: 31 | 32 | ```yaml 33 | - name: Update Homebrew formula 34 | uses: dawidd6/action-homebrew-bump-formula@v4 35 | with: 36 | # Required, custom GitHub access token with the 'public_repo' and 'workflow' scopes 37 | token: ${{secrets.TOKEN}} 38 | # Optional, will commit with this user name 39 | user_name: name 40 | # Optional, will commit with this user email 41 | user_email: email@example.com 42 | # Optional, will create tap repo fork in organization 43 | org: ORG 44 | # Optional, use the origin repository instead of forking 45 | no_fork: false 46 | # Optional, defaults to homebrew/core 47 | tap: USER/REPO 48 | # Formula name, required 49 | formula: FORMULA 50 | # Optional, will be determined automatically 51 | tag: ${{github.ref}} 52 | # Optional, will be determined automatically 53 | revision: ${{github.sha}} 54 | # Optional, if don't want to check for already open PRs 55 | force: false # true 56 | ``` 57 | 58 | ### Livecheck mode 59 | 60 | If `livecheck` input is set to `true`, the Action will run `brew livecheck` to check if any provided formulae are outdated or if tap contains any outdated formulae and then will run `brew bump-formula-pr` on each of those formulae with proper arguments to bump them. 61 | 62 | Might be a good idea to run this on schedule in your tap repo, so one gets automated PRs updating outdated formulae. 63 | 64 | If there are no outdated formulae, the Action will just exit. 65 | 66 | ```yaml 67 | - name: Update Homebrew formula 68 | uses: dawidd6/action-homebrew-bump-formula@v4 69 | with: 70 | # Required, custom personal GitHub access token with only the 'public_repo' scope enabled 71 | token: ${{secrets.CUSTOM_PERSONAL_ACCESS_TOKEN}} 72 | # Optional, will commit with this user name 73 | user_name: user_name 74 | # Optional, will commit with this user email 75 | user_email: email@example.com 76 | # Optional, will create tap repo fork in organization 77 | org: ORG 78 | # Bump all outdated formulae in this tap 79 | tap: USER/REPO 80 | # Bump only these formulae if outdated 81 | formula: FORMULA-1, FORMULA-2, FORMULA-3, ... 82 | # Optional, if don't want to check for already open PRs 83 | force: false # true 84 | # Need to set this input if want to use `brew livecheck` 85 | livecheck: true 86 | ``` 87 | 88 | If only `tap` input is provided, all formulae in given tap will be checked and bumped if needed. 89 | 90 | ## Examples 91 | 92 | - https://github.com/dawidd6/action-homebrew-bump-formula/blob/master/.github/workflows/test.yml 93 | - https://github.com/dawidd6/ba-bump/blob/master/.github/workflows/bump.yml 94 | - https://github.com/ablinov/declutter/blob/master/.github/workflows/bump_homebrew_formula.yml 95 | - https://github.com/jesseduffield/lazygit/blob/master/.github/workflows/cd.yml 96 | - https://github.com/stephan-hesselmann-by/homebrew-BlueYonder/blob/master/.github/workflows/update-tap.yml 97 | - https://github.com/crunchtime-ali/brew-formula-updater/blob/master/.github/workflows/main.yml 98 | - https://github.com/asciidoc/asciidoc-py3/blob/master/.github/workflows/release.yml 99 | - https://github.com/bow-swift/nef/blob/master/.github/workflows/bump-formula.yml 100 | - https://github.com/dandavison/delta/blob/master/.github/workflows/cd.yml 101 | - https://github.com/GitTools/GitVersion/blob/main/.github/workflows/homebrew.yml 102 | - https://github.com/wormi4ok/evernote2md/blob/master/.github/workflows/publish.yml 103 | - https://github.com/cloudskiff/driftctl/blob/main/.github/workflows/homebrew.yml 104 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: Homebrew bump formula 2 | description: Bump (update) a Homebrew formula on new project release 3 | author: dawidd6 4 | branding: 5 | icon: arrow-up-circle 6 | color: yellow 7 | inputs: 8 | token: 9 | description: GitHub token (not the default one) 10 | required: true 11 | user_name: 12 | description: Git user name to commit by. 13 | required: false 14 | user_email: 15 | description: Git user email to commit by. 16 | required: false 17 | message: 18 | description: | 19 | Additional message to append to created PR. 20 | required: false 21 | org: 22 | description: | 23 | Fork tap repository to selected GitHub organization. 24 | required: false 25 | no_fork: 26 | description: | 27 | Use the origin repository instead of forking. 28 | required: false 29 | tap: 30 | description: | 31 | Formula tap. 32 | 33 | In livecheck mode, if formula input is empty, 34 | the Action will check the whole tap. 35 | 36 | Example: dawidd6/tap 37 | Example: dawidd6/homebrew-tap 38 | required: false 39 | tap_url: 40 | description: | 41 | Formula tap URL. 42 | 43 | Specify this if you don't have the repository named $USER/homebrew-$TAP. 44 | Or if your tap is hosted somewhere else. 45 | If you specify this input, the `tap` input needs to be set too. 46 | 47 | Example: http://github.com/dawidd6/action-homebrew-bump-formula.git 48 | required: false 49 | formula: 50 | description: | 51 | Formula name. 52 | 53 | In livecheck mode, this could take more than one formula, 54 | separated by commas or spaces or newlines. 55 | 56 | Example: lazygit 57 | Example (livecheck): lazygit, lazydocker, lazynpm 58 | required: false 59 | tag: 60 | description: | 61 | Git tag. 62 | 63 | It is determined automatically. 64 | 65 | Example: v1.0.0 66 | Example: refs/tags/v1.0.0 67 | required: false 68 | default: ${{github.ref}} 69 | revision: 70 | description: | 71 | Git revision. 72 | 73 | Only required for formulae that use git to download the source. 74 | 75 | It is determined automatically. 76 | 77 | Example: 130d3a3af72f66780ae4e24cd143ae7a4d757f9d 78 | required: false 79 | default: ${{github.sha}} 80 | force: 81 | description: Check open PRs or not (will fail if detected) 82 | required: false 83 | livecheck: 84 | description: | 85 | Use `brew livecheck` to determine outdated formulae. 86 | 87 | If tap input is specified - check all formulae in this tap. 88 | If formula input is specified - check one or more formulae. 89 | If formula and tap inputs are specified - check one or more formulae in that tap. 90 | required: false 91 | runs: 92 | using: composite 93 | steps: 94 | - run: echo /home/linuxbrew/.linuxbrew/bin >> $GITHUB_PATH 95 | if: ${{runner.os == 'Linux'}} 96 | shell: sh 97 | - run: brew developer on 98 | shell: sh 99 | - run: brew update-reset 100 | shell: sh 101 | - run: brew ruby $GITHUB_ACTION_PATH/main.rb 102 | shell: sh 103 | env: 104 | HOMEBREW_GITHUB_API_TOKEN: ${{inputs.token}} 105 | HOMEBREW_GIT_NAME: ${{inputs.user_name}} 106 | HOMEBREW_GIT_EMAIL: ${{inputs.user_email}} 107 | HOMEBREW_BUMP_MESSAGE: ${{inputs.message}} 108 | HOMEBREW_BUMP_ORG: ${{inputs.org}} 109 | HOMEBREW_BUMP_NO_FORK: ${{inputs.no_fork}} 110 | HOMEBREW_BUMP_TAP: ${{inputs.tap}} 111 | HOMEBREW_BUMP_TAP_URL: ${{inputs.tap_url}} 112 | HOMEBREW_BUMP_FORMULA: ${{inputs.formula}} 113 | HOMEBREW_BUMP_TAG: ${{inputs.tag}} 114 | HOMEBREW_BUMP_REVISION: ${{inputs.revision}} 115 | HOMEBREW_BUMP_FORCE: ${{inputs.force}} 116 | HOMEBREW_BUMP_LIVECHECK: ${{inputs.livecheck}} 117 | -------------------------------------------------------------------------------- /bump-formula-pr.rb.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb 2 | index 167ea9134a..e07aecfe83 100644 3 | --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb 4 | +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb 5 | @@ -472,6 +472,7 @@ module Homebrew 6 | def check_pull_requests(formula, tap_remote_repo, state: nil, version: nil) 7 | tap = formula.tap 8 | return if tap.nil? 9 | + return if args.force? 10 | 11 | # if we haven't already found open requests, try for an exact match across all pull requests 12 | GitHub.check_for_duplicate_pull_requests( 13 | -------------------------------------------------------------------------------- /main.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'formula' 4 | 5 | class Object 6 | def false? 7 | nil? 8 | end 9 | end 10 | 11 | class String 12 | def false? 13 | empty? || strip == 'false' 14 | end 15 | end 16 | 17 | module Homebrew 18 | module_function 19 | 20 | def print_command(*cmd) 21 | puts "[command]#{cmd.join(' ').gsub("\n", ' ')}" 22 | end 23 | 24 | def brew(*args) 25 | print_command ENV["HOMEBREW_BREW_FILE"], *args 26 | safe_system ENV["HOMEBREW_BREW_FILE"], *args 27 | end 28 | 29 | def git(*args) 30 | print_command ENV["HOMEBREW_GIT"], *args 31 | safe_system ENV["HOMEBREW_GIT"], *args 32 | end 33 | 34 | def read_brew(*args) 35 | print_command ENV["HOMEBREW_BREW_FILE"], *args 36 | output = `#{ENV["HOMEBREW_BREW_FILE"]} #{args.join(' ')}`.chomp 37 | odie output if $CHILD_STATUS.exitstatus != 0 38 | output 39 | end 40 | 41 | # Get inputs 42 | message = ENV['HOMEBREW_BUMP_MESSAGE'] 43 | user_name = ENV['HOMEBREW_GIT_NAME'] 44 | user_email = ENV['HOMEBREW_GIT_EMAIL'] 45 | org = ENV['HOMEBREW_BUMP_ORG'] 46 | no_fork = ENV['HOMEBREW_BUMP_NO_FORK'] 47 | tap = ENV['HOMEBREW_BUMP_TAP'] 48 | tap_url = ENV['HOMEBREW_BUMP_TAP_URL'] 49 | formula = ENV['HOMEBREW_BUMP_FORMULA'] 50 | tag = ENV['HOMEBREW_BUMP_TAG'] 51 | revision = ENV['HOMEBREW_BUMP_REVISION'] 52 | force = ENV['HOMEBREW_BUMP_FORCE'] 53 | livecheck = ENV['HOMEBREW_BUMP_LIVECHECK'] 54 | 55 | # Check inputs 56 | if livecheck.false? 57 | odie "Need 'formula' input specified" if formula.blank? 58 | odie "Need 'tag' input specified" if tag.blank? 59 | end 60 | 61 | # Get user details 62 | user = GitHub::API.open_rest "#{GitHub::API_URL}/user" 63 | user_id = user['id'] 64 | user_login = user['login'] 65 | user_name = user['name'] || user['login'] if user_name.blank? 66 | user_email = user['email'] || ( 67 | # https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address 68 | user_created_at = Date.parse user['created_at'] 69 | plus_after_date = Date.parse '2017-07-18' 70 | need_plus_email = (user_created_at - plus_after_date).positive? 71 | user_email = "#{user_login}@users.noreply.github.com" 72 | user_email = "#{user_id}+#{user_email}" if need_plus_email 73 | user_email 74 | ) if user_email.blank? 75 | 76 | # Tell git who you are 77 | git 'config', '--global', 'user.name', user_name 78 | git 'config', '--global', 'user.email', user_email 79 | 80 | if tap.blank? 81 | brew 'tap', 'homebrew/core', '--force' 82 | else 83 | # Tap the requested tap if applicable 84 | brew 'tap', tap, *(tap_url unless tap_url.blank?) 85 | end 86 | 87 | # Append additional PR message 88 | message = if message.blank? 89 | '' 90 | else 91 | message + "\n\n" 92 | end 93 | message += '[`action-homebrew-bump-formula`](https://github.com/dawidd6/action-homebrew-bump-formula)' 94 | 95 | unless force.false? 96 | brew_repo = read_brew '--repository' 97 | git '-C', brew_repo, 'apply', "#{__dir__}/bump-formula-pr.rb.patch" 98 | end 99 | 100 | # Do the livecheck stuff or not 101 | if livecheck.false? 102 | # Change formula name to full name 103 | formula = tap + '/' + formula if !tap.blank? && !formula.blank? 104 | 105 | # Get info about formula 106 | stable = Formula[formula].stable 107 | is_git = stable.downloader.is_a? GitDownloadStrategy 108 | 109 | # Prepare tag and url 110 | tag = tag.delete_prefix 'refs/tags/' 111 | version = Version.parse tag 112 | 113 | # Finally bump the formula 114 | brew 'bump-formula-pr', 115 | '--no-audit', 116 | '--no-browse', 117 | "--message=#{message}", 118 | *("--fork-org=#{org}" unless org.blank?), 119 | *("--no-fork" unless no_fork.false?), 120 | *("--version=#{version}" unless is_git), 121 | *("--tag=#{tag}" if is_git), 122 | *("--revision=#{revision}" if is_git), 123 | *("--force" unless force.false?), 124 | formula 125 | else 126 | # Support multiple formulae in input and change to full names if tap 127 | unless formula.blank? 128 | formula = formula.split(/[ ,\n]/).reject(&:blank?) 129 | formula = formula.map { |f| tap + '/' + f } unless tap.blank? 130 | end 131 | 132 | # Get livecheck info 133 | json = read_brew 'livecheck', 134 | '--formula', 135 | '--quiet', 136 | '--newer-only', 137 | '--full-name', 138 | '--json', 139 | *("--tap=#{tap}" if !tap.blank? && formula.blank?), 140 | *(formula unless formula.blank?) 141 | json = JSON.parse json 142 | 143 | # Define error 144 | err = nil 145 | 146 | # Loop over livecheck info 147 | json.each do |info| 148 | # Skip if there is no version field 149 | next unless info['version'] 150 | 151 | # Get info about formula 152 | formula = info['formula'] 153 | version = info['version']['latest'] 154 | 155 | begin 156 | # Finally bump the formula 157 | brew 'bump-formula-pr', 158 | '--no-audit', 159 | '--no-browse', 160 | "--message=#{message}", 161 | "--version=#{version}", 162 | *("--fork-org=#{org}" unless org.blank?), 163 | *("--no-fork" unless no_fork.false?), 164 | *("--force" unless force.false?), 165 | formula 166 | rescue ErrorDuringExecution => e 167 | # Continue execution on error, but save the exeception 168 | err = e 169 | end 170 | end 171 | 172 | # Die if error occured 173 | odie err if err 174 | end 175 | end 176 | --------------------------------------------------------------------------------