diff --git a/.github/workflows/dispatch-build-bottle.yml b/.github/workflows/dispatch-build-bottle.yml index bf69fe1869475..906aec18306df 100644 --- a/.github/workflows/dispatch-build-bottle.yml +++ b/.github/workflows/dispatch-build-bottle.yml @@ -114,6 +114,24 @@ jobs: bottles-directory: ${{ env.BOTTLES_DIR }} cleanup: ${{ matrix.cleanup }} + - name: Check for existing bottle + shell: brew ruby {0} + env: + HOMEBREW_DISPATCHED_FORMULA: ${{ inputs.formula }} + run: | + formula_name = ENV.fetch("HOMEBREW_DISPATCHED_FORMULA") + formula = Formulary.factory(formula_name) + current_bottle_tag = Utils::Bottles.tag + bottled_on_current_os = formula.bottle_specification.tag?(current_bottle_tag, no_older_versions: true) + + return unless bottled_on_current_os + + puts GitHub::Actions::Annotation.new( + :error, + "#{formula_name} already has a bottle for #{current_bottle_tag}!", + ) + exit 1 + - working-directory: ${{ env.BOTTLES_DIR }} run: | brew test-bot \