@@ -12,6 +12,8 @@ permissions:
1212jobs :
1313 brew :
1414 runs-on : ubuntu-latest
15+ env :
16+ HOMEBREW_TAP_REPOSITORY : ${{ vars.HOMEBREW_TAP_REPOSITORY }}
1517 steps :
1618 - uses : actions/checkout@v4
1719
2123 run : |
2224 if [ -z "${HOMEBREW_TAP_GITHUB_TOKEN}" ]; then
2325 echo "HOMEBREW_TAP_GITHUB_TOKEN is not configured for this repository." >&2
24- echo "Add a token with write access to libi/homebrew-tap in Settings > Secrets and variables > Actions." >&2
26+ echo "Add a token with write access to your Homebrew tap repository in Settings > Secrets and variables > Actions." >&2
27+ exit 1
28+ fi
29+
30+ - name : Validate tap repository
31+ run : |
32+ TAP_REPOSITORY="${HOMEBREW_TAP_REPOSITORY:-libi/homebrew-tap}"
33+ if ! git ls-remote "https://github.com/${TAP_REPOSITORY}.git" >/dev/null 2>&1; then
34+ echo "Homebrew tap repository not found: ${TAP_REPOSITORY}" >&2
35+ echo "Create the repository first, then set Actions variable HOMEBREW_TAP_REPOSITORY if you are not using libi/homebrew-tap." >&2
2536 exit 1
2637 fi
2738
@@ -30,10 +41,11 @@ jobs:
3041 TAG : ${{ github.ref_name }}
3142 HOMEBREW_TAP_GITHUB_TOKEN : ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
3243 run : |
44+ TAP_REPOSITORY="${HOMEBREW_TAP_REPOSITORY:-libi/homebrew-tap}"
3345 curl -fsSL -o /tmp/ko-browser-src.tar.gz "https://github.com/libi/ko-browser/archive/refs/tags/${TAG}.tar.gz"
3446 SHA256=$(shasum -a 256 /tmp/ko-browser-src.tar.gz | awk '{print $1}')
3547
36- git clone "https://x-access-token:${HOMEBREW_TAP_GITHUB_TOKEN}@github.com/libi/homebrew-tap .git" /tmp/homebrew-tap
48+ git clone "https://x-access-token:${HOMEBREW_TAP_GITHUB_TOKEN}@github.com/${TAP_REPOSITORY} .git" /tmp/homebrew-tap
3749 mkdir -p /tmp/homebrew-tap/Formula
3850
3951 ./scripts/render-homebrew-formula.sh "${TAG}" "${SHA256}" > /tmp/homebrew-tap/Formula/ko-browser.rb
0 commit comments