Skip to content

Commit

Permalink
add tap_url input, add testdata here
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidd6 committed Oct 9, 2024
1 parent df6d545 commit 3e0d4be
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 15 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/close-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Close Pull Request

on:
pull_request:
types:
- opened
paths:
- "Formula/*.rb"

concurrency:
group: close-pr
cancel-in-progress: false

jobs:
close-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Delete
run: git push origin --delete ${{github.event.pull_request.head.ref}}
25 changes: 11 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- "*"
paths-ignore:
- README.md
workflow_dispatch:

concurrency:
group: test
Expand All @@ -15,24 +16,14 @@ jobs:
test:
strategy:
matrix:
formula:
- test-formula-url
- test-formula-git-revision
- test-formula-pypi-url
include:
- formula: test-formula-url
tap: dawidd6/test
tag: v0.1.12
force: true
- formula: test-formula-git-revision
tap: dawidd6/test
tag: v0.3.3
revision: c43abd765cf51c06bbcaa5479dc49aab1396989f
force: true
- formula: test-formula-pypi-url
tap: dawidd6/test
tag: v2.42.0
force: true
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -41,11 +32,13 @@ jobs:
uses: ./
with:
token: ${{secrets.TOKEN}}
tap: ${{matrix.tap}}
tap: ${{github.repository}}
tap_url: ${{github.server_url}}/${{github.repository}}.git
formula: ${{matrix.formula}}
tag: ${{matrix.tag}}
revision: ${{matrix.revision}}
force: ${{matrix.force}}
force: true
no_fork: true
test-livecheck-formula:
runs-on: macos-latest
needs:
Expand All @@ -64,9 +57,11 @@ jobs:
test-formula-url
test-formula-git-revision
test-formula-pypi-url
tap: dawidd6/test
tap: ${{github.repository}}
tap_url: ${{github.server_url}}/${{github.repository}}.git
force: true
livecheck: true
no_fork: true
test-livecheck-tap:
runs-on: ubuntu-latest
needs:
Expand All @@ -83,6 +78,8 @@ jobs:
message: |
First line
SECOND LINE
tap: dawidd6/test
tap: ${{github.repository}}
tap_url: ${{github.server_url}}/${{github.repository}}.git
force: true
livecheck: true
no_fork: true
21 changes: 21 additions & 0 deletions Formula/test-formula-git-revision.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class TestFormulaGitRevision < Formula
desc "Formula to test Action"
homepage "/~https://github.com/Debian/dh-make-golang"
url "/~https://github.com/Debian/dh-make-golang.git",
tag: "v0.3.2",
revision: "82916c0d56b6319398f635199222dff397fafc12"
license "MIT"
head "/~https://github.com/Debian/dh-make-golang.git"

def install
(buildpath/"test").write <<~EOS
test
EOS

share.install "test"
end

test do
sleep 1
end
end
54 changes: 54 additions & 0 deletions Formula/test-formula-pypi-url.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class TestFormulaPypiUrl < Formula
include Language::Python::Virtualenv

desc "Formula to test Action"
homepage "https://commitizen-tools.github.io/commitizen/"
url "https://files.pythonhosted.org/packages/a1/14/3ad1772b81f1e2f7c91ac99987c0ac72a50ebe2a06967cf9a3eea81dd0d0/commitizen-2.14.0.tar.gz"
sha256 "afc68d9d61c8338beeb6145a8276e97a342a16f4f721c8ff654403043240cec0"
license "MIT"
head "/~https://github.com/commitizen-tools/commitizen.git"

depends_on "python@3.9"

resource "argcomplete" do
url "https://files.pythonhosted.org/packages/cb/53/d2e3d11726367351b00c8f078a96dacb7f57aef2aca0d3b6c437afc56b55/argcomplete-1.12.2.tar.gz"
sha256 "de0e1282330940d52ea92a80fea2e4b9e0da1932aaa570f84d268939d1897b04"
end

resource "colorama" do
url "https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz"
sha256 "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"
end

resource "decli" do
url "https://files.pythonhosted.org/packages/9f/30/064f53ca7b75c33a892dcc4230f78a1e01bee4b5b9b49c0be1a61601c9bd/decli-0.5.2.tar.gz"
sha256 "f2cde55034a75c819c630c7655a844c612f2598c42c21299160465df6ad463ad"
end

resource "Jinja2" do
url "https://files.pythonhosted.org/packages/4f/e7/65300e6b32e69768ded990494809106f87da1d436418d5f1367ed3966fd7/Jinja2-2.11.3.tar.gz"
sha256 "a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"
end

resource "MarkupSafe" do
url "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz"
sha256 "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"
end

resource "packaging" do
url "https://files.pythonhosted.org/packages/86/3c/bcd09ec5df7123abcf695009221a52f90438d877a2f1499453c6938f5728/packaging-20.9.tar.gz"
sha256 "5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5"
end

def install
(buildpath/"test").write <<~EOS
test
EOS

share.install "test"
end

test do
sleep 1
end
end
19 changes: 19 additions & 0 deletions Formula/test-formula-url.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class TestFormulaUrl < Formula
desc "Formula to test Action"
homepage "/~https://github.com/dawidd6/actions-updater"
url "/~https://github.com/dawidd6/actions-updater/archive/v0.1.11.tar.gz"
sha256 "b1c83ee9d19289eb403ad0863c235fa9c3b3a980c9b13a43cda9fc9413935df4"
license "MIT"

def install
(buildpath/"test").write <<~EOS
test
EOS

share.install "test"
end

test do
sleep 1
end
end
11 changes: 11 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ inputs:
Example: dawidd6/tap
Example: dawidd6/homebrew-tap
required: false
tap_url:
description: |
Formula tap URL.
Specify this if you don't have the repository named $USER/homebrew-$TAP.
Or if your tap is hosted somewhere else.
If you specify this input, the `tap` input needs to be set too.
Example: http://github.com/dawidd6/action-homebrew-bump-formula.git
required: false
formula:
description: |
Formula name.
Expand Down Expand Up @@ -95,6 +105,7 @@ runs:
HOMEBREW_BUMP_ORG: ${{inputs.org}}
HOMEBREW_BUMP_NO_FORK: ${{inputs.no_fork}}
HOMEBREW_BUMP_TAP: ${{inputs.tap}}
HOMEBREW_BUMP_TAP_URL: ${{inputs.tap_url}}
HOMEBREW_BUMP_FORMULA: ${{inputs.formula}}
HOMEBREW_BUMP_TAG: ${{inputs.tag}}
HOMEBREW_BUMP_REVISION: ${{inputs.revision}}
Expand Down
3 changes: 2 additions & 1 deletion main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def read_brew(*args)
org = ENV['HOMEBREW_BUMP_ORG']
no_fork = ENV['HOMEBREW_BUMP_NO_FORK']
tap = ENV['HOMEBREW_BUMP_TAP']
tap_url = ENV['HOMEBREW_BUMP_TAP_URL']
formula = ENV['HOMEBREW_BUMP_FORMULA']
tag = ENV['HOMEBREW_BUMP_TAG']
revision = ENV['HOMEBREW_BUMP_REVISION']
Expand Down Expand Up @@ -80,7 +81,7 @@ def read_brew(*args)
brew 'tap', 'homebrew/core', '--force'
else
# Tap the requested tap if applicable
brew 'tap', tap
brew 'tap', tap, *(tap_url unless tap_url.blank?)
end

# Append additional PR message
Expand Down

0 comments on commit 3e0d4be

Please sign in to comment.