sql-action icon indicating copy to clipboard operation
sql-action copied to clipboard

Example `path: './sqlscripts/*.sql'` doesn't work

Open cuzzlor opened this issue 1 year ago • 3 comments

When I try running two scripts as per this example:

path: './sqlscripts/*.sql'

I receive an error:

Error: Multiple files found matching pattern ./sqlscripts/*.sql

If only one script is supported, might be best to update the example code?

cuzzlor avatar Feb 09 '24 06:02 cuzzlor

This issue is idle because it has been open for 14 days with no activity.

github-actions[bot] avatar Feb 23 '24 15:02 github-actions[bot]

Unfortunately at the moment in V2.2, sql-action will only allow 1 script to be ran at a time, regardless of the readme stating scripts.

I got around this by creating a 1 dimensional matrix to iterate through a directory full of scripts.

example:

jobs:
  deploy_setup:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v4
      - id: set-matrix
        run: echo "deploymatrix=$(ls /sqlscripts/*.sql | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
    outputs:
      deploymatrix: ${{ steps.set-matrix.outputs.deploymatrix }}
  mssqldeploy:
    needs: [deploy_setup]
    runs-on: self-hosted
    strategy:
      matrix:
        deployfiles: ${{ fromJson(needs.deploy_setup.outputs.deploymatrix) }}
      max-parallel: 1
    steps:
      - uses: actions/checkout@v4
      - name: Deploy to Target
        uses: Azure/[email protected]
        with:
          connection-string: "${{ secrets.CONNECTION_STRING }}"
          path: './${{ matrix.deployfiles }}'
          arguments: -b 

Also, see this Issue for more another similar Issue..

joe-schmirler avatar Feb 24 '24 02:02 joe-schmirler

This issue is idle because it has been open for 14 days with no activity.

github-actions[bot] avatar Mar 09 '24 06:03 github-actions[bot]