From f172ec18aebac081976399856d1722bda20abb9f Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 26 Jul 2024 13:13:53 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A7=20(package.yml):=20add=20insta?= =?UTF-8?q?llation=20step=20for=20GitHub=20CLI=20to=20enable=20usage=20in?= =?UTF-8?q?=20the=20workflow=20=F0=9F=94=A7=20(package.yml):=20introduce?= =?UTF-8?q?=20a=20step=20to=20check=20for=20an=20existing=20Homebrew=20for?= =?UTF-8?q?mula=20PR=20before=20updating=20it=20to=20avoid=20creating=20du?= =?UTF-8?q?plicate=20PRs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/package.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 51876008..817c6958 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -55,6 +55,9 @@ jobs: with: ruby-version: 3.1.4 + - name: Install GitHub CLI + run: sudo apt-get update && sudo apt-get install gh -y + - name: Get Reusable Files run: | # Under the src folder is where specific packages files live. The GitHub action inputs will modify the universal package-deb-pom.xml to tell the process which assets to use during the packaging step @@ -130,7 +133,28 @@ jobs: mv ${{ inputs.artifactId }}-${{ inputs.version }}-1.noarch* $PWD/yum/noarch aws s3 sync $PWD/yum s3://repo.liquibase.com/yum + + - name: Check for existing Homebrew formula PR for ${{ inputs.artifactId }} + id: check-brew-pr + run: | + # Authenticate GitHub CLI + echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token + + # Define the PR title + pr_title="liquibase ${{ inputs.version }}" + + # Search for open pull requests with the specified title in the Homebrew/homebrew-core repo + pr_exists=$(gh pr list --repo Homebrew/homebrew-core --state open --search "$pr_title" --json title --jq ".[] | select(.title == \"$pr_title\") | .title" || true) + echo "pr_exists: $pr_exists" + # Set the environment variable based on whether the PR exists + if [ -n "$pr_exists" ]; then + echo "PR_EXISTS=true" >> $GITHUB_ENV + else + echo "PR_EXISTS=false" >> $GITHUB_ENV + fi + - name: Update Homebrew formula for ${{ inputs.artifactId }} + if: env.PR_EXISTS == 'false' uses: mislav/bump-homebrew-formula-action@v3 with: formula-name: liquibase From 9a6c447cc7a42706781620fdd8afb30ef116a984 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Tue, 6 Aug 2024 13:57:17 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A7=20(package.yml):=20remove=20in?= =?UTF-8?q?stallation=20of=20GitHub=20CLI=20as=20it=20is=20no=20longer=20n?= =?UTF-8?q?eeded=20for=20the=20workflow=20to=20function=20properly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/package.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 964905e0..0d2c2343 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -55,9 +55,6 @@ jobs: with: ruby-version: 3.1.4 - - name: Install GitHub CLI - run: sudo apt-get update && sudo apt-get install gh -y - - name: Get Reusable Files run: | # Under the src folder is where specific packages files live. The GitHub action inputs will modify the universal package-deb-pom.xml to tell the process which assets to use during the packaging step