Hi @Pulipati Vedanth ,
Thanks for using Microsoft Q&A !!
If you want to execute any SQL Query through GitHub Actions then you can create a SQL Script file (with your SQL Insert statements) in your repository at root level and refer the SQL file using sql-file:
attribute under azure/sql-action@v1
section of YAML. Once build is run, it will pick up the script file and execute it on the specific azure SQL server. Please refer to the below YAML snippet (Check line 23) for your reference.
name: SQL for GitHub Actions
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: azure/login@v1
with:
creds: ${<!-- -->{ secrets.AZURE_CREDENTIALS }}
- uses: azure/sql-action@v1
with:
server-name: 'servername.database.windows.net'
connection-string: ${<!-- -->{ secrets.AZURE_SQL_CONNECTION_STRING }}
sql-file: './test_sql_script.sql'
# Azure logout
- name: logout
run: |
az logout
SQL Script file:
Content:
So, when the workflow runs it executes the SQL script file as shown below -
Please let me know if you have any questions.
Thanks
Saurabh
----------
Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.