diff --git a/.github/workflows/azure-login-pr-check.yml b/.github/workflows/azure-login-pr-check.yml new file mode 100644 index 00000000..c9621596 --- /dev/null +++ b/.github/workflows/azure-login-pr-check.yml @@ -0,0 +1,70 @@ +name: pr-check + +on: + pull_request_target: + branches: + - master + - 'releases/*' + - users/balaga-gayatri/test-automation +jobs: + az-login-test: + environment: Automation test + runs-on: windows-latest + steps: + - name: Checkout from PR branch + uses: actions/checkout@v2 + + # Using 12.x version as an example + - name: Set Node.js 12.x for GitHub Action + uses: actions/setup-node@v1 + with: + node-version: 12.x + + - name: installing node_modules + run: npm install + + - name: Build GitHub Action + run: npm run build + + - name: 'Az CLI login with subscription' + uses: ./ + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - run: | + az account show + # az webapp list + + - name: 'Az CLI login without subscription' + uses: ./ + with: + creds: ${{ secrets.AZURE_CREDENTIALS_NO_SUB }} + allow-no-subscriptions: true + + - run: | + az account show + + - name: 'Azure PowerShell login with subscription' + uses: ./ + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + enable-AzPSSession: true + + - uses: azure/powershell@v1 + with: + inlineScript: "Get-AzContext" + azPSVersion: "latest" + + - name: 'Azure PowerShell login without subscription' + uses: ./ + with: + creds: ${{secrets.AZURE_CREDENTIALS_NO_SUB}} + enable-AzPSSession: true + allow-no-subscriptions: true + + - uses: azure/powershell@v1 + with: + inlineScript: "Get-AzContext" + azPSVersion: "latest" + + diff --git a/README.md b/README.md index f968b50f..d493376c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # GitHub Actions for deploying to Azure - +# testing for pr-check ## Automate your GitHub workflows using Azure Actions [GitHub Actions](https://help.github.com/en/articles/about-github-actions) gives you the flexibility to build an automated software development lifecycle workflow. diff --git a/lib/main.js b/lib/main.js index 274dc1d3..757ea13b 100644 --- a/lib/main.js +++ b/lib/main.js @@ -53,7 +53,7 @@ function main() { }; yield executeAzCliCommand("--version", true, execOptions); core.debug(`az cli version used:\n${output}`); - let creds = core.getInput('creds', { required: true }); +// let creds = core.getInput('creds', { required: true }); let secrets = new actions_secret_parser_1.SecretParser(creds, actions_secret_parser_1.FormatType.JSON); let servicePrincipalId = secrets.getSecret("$.clientId", false); let servicePrincipalKey = secrets.getSecret("$.clientSecret", true); diff --git a/src/main.ts b/src/main.ts index abc1c4d7..a2534cad 100644 --- a/src/main.ts +++ b/src/main.ts @@ -39,7 +39,7 @@ async function main() { await executeAzCliCommand("--version", true, execOptions); core.debug(`az cli version used:\n${output}`); - let creds = core.getInput('creds', { required: true }); +// let creds = core.getInput('creds', { required: true }); let secrets = new SecretParser(creds, FormatType.JSON); let servicePrincipalId = secrets.getSecret("$.clientId", false); let servicePrincipalKey = secrets.getSecret("$.clientSecret", true); @@ -173,4 +173,4 @@ async function executeAzCliCommand( } } -main(); \ No newline at end of file +main();