diff --git a/.github/workflows/update-batch-vms.yml b/.github/workflows/update-batch-vms.yml index 7b5145632..bb3721937 100644 --- a/.github/workflows/update-batch-vms.yml +++ b/.github/workflows/update-batch-vms.yml @@ -10,6 +10,9 @@ jobs: name: Update Batch VMs db runs-on: ubuntu-latest environment: test + permissions: + contents: write + pull-requests: write steps: - name: Azure login @@ -34,14 +37,19 @@ jobs: run: dotnet restore - name: Build - run: dotnet build - - - name: Run GenerateBatchVmSkus - run: ./src/GenerateBatchVmSkus/bin/Debug/net7.0/GenerateBatchVmSkus --subscriptionId ${{ secrets.AZURE_SUBSCRIPTION_ID }} --outputFilePath src/TesApi.Web/BatchSupportedVmSizeInformation.json --TestedVmSkus src/TesApi.Web/DefaultVmPrices.json + run: dotnet build --no-restore - name: Restore nuget.config run: git restore nuget.config + - name: Retrieve configuration + run: echo "$APPSETTINGS" > src/GenerateBatchVmSkus/bin/Debug/net8.0/appsettings.json + env: + APPSETTINGS: ${{ secrets.AZURE_VM_TEST_CONFIG }} + + - name: Run GenerateBatchVmSkus + run: ./src/GenerateBatchVmSkus/bin/Debug/net8.0/GenerateBatchVmSkus --outputFilePath src/TesApi.Web/BatchSupportedVmSizeInformation.json + - run: if (( $(git diff src/TesApi.Web/BatchSupportedVmSizeInformation.json | wc -l) > 0 )); then echo "UPDATE_PR=True" >> $GITHUB_ENV; fi - name: Checkout branch, commit and push @@ -58,8 +66,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - #- name: create pull request - # if: env.UPDATE_PR != null && env.SUBMIT_PR != null - # run: gh pr create --assignee jsaun -B develop -H update-batch-vms --title 'Update BatchSupportedVmSizeInformation.json' --body 'Update BatchSupportedVmSizeInformation.json' - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: create pull request + if: env.UPDATE_PR != null && env.SUBMIT_PR != null + run: gh pr create --assignee jsaun -B develop -H update-batch-vms --title 'Update BatchSupportedVmSizeInformation.json' --body 'Update BatchSupportedVmSizeInformation.json' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}