diff --git a/.github/workflows/update-sqldef-version.yaml b/.github/workflows/update-sqldef-version.yaml index b62259f..77857e2 100644 --- a/.github/workflows/update-sqldef-version.yaml +++ b/.github/workflows/update-sqldef-version.yaml @@ -84,12 +84,20 @@ jobs: echo "branch=$BRANCH_NAME" >> $GITHUB_ENV + - name: Install yq + run: | + curl -sL -o /tmp/yq https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 + sudo install -m 755 /tmp/yq /usr/local/bin/yq + yq --version + env: + YQ_VERSION: v4.47.2 + - name: Update version in action.yml env: VERSION: ${{ steps.version.outputs.version }} run: | # Store current version for comparison - CURRENT_VERSION=$(grep -A 1 "description: 'Version of sqldef to use'" action.yml | grep "default:" | sed "s/.*default: '\(v[0-9.]*[^']*\)'.*/\1/") + CURRENT_VERSION=$(yq '.inputs.version.default' action.yml) if [ "$CURRENT_VERSION" = "$VERSION" ]; then echo "Version is already set to $VERSION, no changes needed" @@ -97,12 +105,9 @@ jobs: else echo "Updating from $CURRENT_VERSION to $VERSION" - # Update the default version in action.yml (more precise sed pattern) - sed -i "s/\(default: '\)v[0-9]\+\.[0-9]\+\.[0-9]\+\(-[a-zA-Z0-9._-]\+\)\?\('/\1$VERSION\3/" action.yml + # Update the default version in action.yml using yq + yq -i '.inputs.version.default = strenv(VERSION)' action.yml - # Verify the change - echo "Updated action.yml:" - grep -A 1 "description: 'Version of sqldef to use'" action.yml echo "changed=true" >> $GITHUB_ENV fi diff --git a/action.yml b/action.yml index 04f3670..817a1b1 100644 --- a/action.yml +++ b/action.yml @@ -17,7 +17,7 @@ inputs: version: description: 'Version of sqldef to use' required: false - default: 'v3.0.1' + default: 'v3.1.2' config-file: description: 'Path to sqldef config file' required: false @@ -79,12 +79,10 @@ inputs: mssql-database: description: 'SQL Server database' required: false - # GitHub token for PR comments github-token: description: 'GitHub token for commenting on pull requests' required: true - runs: using: 'node24' main: 'dist/index.js'