Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/update-sqldef-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,30 @@ 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"
echo "changed=false" >> $GITHUB_ENV
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

Expand Down
4 changes: 1 addition & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'