From 9cafb72631ff757495797fa0718b9477dfc97072 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 29 Jan 2026 21:57:20 +0000 Subject: [PATCH 1/3] Fix tip installs and robust goose version resolution Co-authored-by: msc --- action.yml | 62 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/action.yml b/action.yml index 039db4a..36e2d49 100644 --- a/action.yml +++ b/action.yml @@ -5,7 +5,7 @@ branding: color: green inputs: version: - description: 'Version of goose to install (tip, latest-release, v0.14.1, etc.)' + description: 'Version of goose to install (tip, latest-release, v3.26.0, etc.)' required: true default: 'latest-release' runs: @@ -13,25 +13,36 @@ runs: steps: - shell: bash run: | - set -ex + set -euo pipefail + set -x + + version="${{ inputs.version }}" # Install goose: # - if version is "tip", install from tip of main. # - if version is "latest-release", look up latest release. # - otherwise, install the specified version. - case ${{ inputs.version }} in + case "${version}" in tip) echo "Installing goose using go install" - go install github.com/pressly/goose/v3/cmd/goose@latest - ;; - latest-release) - tag=$(curl -L -s -u "username:${{ github.token }}" https://api.github.com/repos/pressly/goose/releases/latest | jq -r '.tag_name') - ;; - *) - tag="${{ inputs.version }}" + go install github.com/pressly/goose/v3/cmd/goose@main + echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" + exit 0 esac + if [[ "${version}" == "latest-release" ]]; then + tag="$( + curl -fsSL \ + -H "Authorization: Bearer ${{ github.token }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/pressly/goose/releases/latest" \ + | python -c 'import json,sys; print(json.load(sys.stdin)["tag_name"])' + )" + else + tag="${version}" + fi + case ${{ runner.os }} in macOS) os="darwin" @@ -61,12 +72,27 @@ runs: ;; esac - if [[ ! -z ${tag} ]]; then - echo "Installing goose @ ${tag} for ${os}_${arch}" - if [[ $os == "windows" ]]; then - powershell -Command "Invoke-WebRequest -Uri https://github.com/pressly/goose/releases/download/${tag}/goose_${os}_${arch}.exe -OutFile C:\goose\goose.exe" - else - curl -fsL https://github.com/pressly/goose/releases/download/${tag}/goose_${os}_${arch} > /usr/local/bin/goose - chmod +x /usr/local/bin/goose - fi + if [[ -z "${tag}" ]]; then + echo "Failed to resolve goose release tag" + exit 1 fi + + install_dir="${RUNNER_TEMP:-/tmp}/goose/bin" + mkdir -p "${install_dir}" + + ext="" + if [[ "${os}" == "windows" ]]; then + ext=".exe" + fi + + asset="goose_${os}_${arch}${ext}" + dest="${install_dir}/goose${ext}" + + echo "Installing goose @ ${tag} (${asset})" + curl -fsSL -o "${dest}" "https://github.com/pressly/goose/releases/download/${tag}/${asset}" + + if [[ "${os}" != "windows" ]]; then + chmod +x "${dest}" + fi + + echo "${install_dir}" >> "$GITHUB_PATH" From fa286d69fd65be8799c98bdd9d1698c91c3fe7e6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 29 Jan 2026 21:57:27 +0000 Subject: [PATCH 2/3] Update docs and CI for current goose versions Co-authored-by: msc --- .github/workflows/use_action.yml | 4 ++++ README.md | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/use_action.yml b/.github/workflows/use_action.yml index e5545d9..ea4af93 100644 --- a/.github/workflows/use_action.yml +++ b/.github/workflows/use_action.yml @@ -14,8 +14,12 @@ jobs: platform: - ubuntu-latest - macos-latest + - windows-latest runs-on: ${{ matrix.platform }} + defaults: + run: + shell: bash steps: - uses: actions/setup-go@v5 diff --git a/README.md b/README.md index 3944859..0825032 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.20.x' + go-version: '1.22.x' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: mscno/setup-goose@v1 @@ -29,20 +29,20 @@ jobs: That's it! This workflow will run your migrations using goose. -The action works on Linux and macOS runners. If you'd like support for Windows runners, let us know! +The action works on Linux, macOS, and Windows runners. ## Select goose version to install -By default, pressly/setup-goose installs the latest released version of goose. +By default, mscno/setup-goose installs the latest released version of goose. You can select a version with the version parameter: ```yaml - uses: mscno/setup-goose@v1 with: - version: v0.14.1 + version: v3.26.0 ``` -To build and install goose from source using go install, specify version: `tip`. +To build and install goose from source using `go install`, specify `version: tip`. ## Running Migrations @@ -59,6 +59,6 @@ After installing goose with this action, you can run your migrations with goose You can also run specific migrations with goose up-to , roll back migrations with goose down, and more. See the goose documentation for more information. ## A note on versioning -The @v0.X in the uses statement refers to the version of the action definition in this repo. +The `@v1` in the `uses:` statement refers to the version of the action definition in this repo. -Regardless of what version of the action definition you use, pressly/setup-goose will install the latest released version of goose unless otherwise specified with version:. +Regardless of what version of the action definition you use, mscno/setup-goose will install the latest released version of goose unless otherwise specified with `version:`. From 51106b490707a6f5ff580cf9eb48f4edb219b860 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 12 Feb 2026 21:30:01 +0000 Subject: [PATCH 3/3] Avoid logging GitHub token in action output Co-authored-by: Mads Schou --- action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yml b/action.yml index 36e2d49..9f9fbdd 100644 --- a/action.yml +++ b/action.yml @@ -14,7 +14,6 @@ runs: - shell: bash run: | set -euo pipefail - set -x version="${{ inputs.version }}"