diff --git a/.github/workflows/check-concurrent-workflows.yml b/.github/workflows/check-concurrent-workflows.yml deleted file mode 100644 index 0e977a39..00000000 --- a/.github/workflows/check-concurrent-workflows.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: "Check concurrent workflows" -on: - workflow_call: - outputs: - active-runs: - description: "Whether there are active runs ('true'|'false')" - value: ${{ jobs.checkWorkflowRuns.outputs.result }} - -jobs: - checkWorkflowRuns: - name: "Check current workflow runs" - runs-on: [ ubuntu-latest ] - outputs: - result: ${{ steps.check-workflow-runs.outputs.result }} - steps: - - name: "Get runs" - id: check-workflow-runs - env: - GH_TOKEN: ${{ github.token }} - shell: pwsh - run: | - function Check-For-Ongoing-Runs { - $currentRepository = "${{ github.repository }}" - $currentWorkflow = "${{ github.workflow }}" - $currentRunNumber = "${{ github.run_number }}" - - $workflows = - @{Repository='ansys/grantami-recordlists'; Name='CI'}, - @{Repository='ansys/grantami-bomanalytics'; Name='Pre-merge checks'} - - foreach ($workflow in $workflows) { - if (($workflow.Repository -eq $currentRepository) -and ($workflow.Name -eq $currentWorkflow)) { - $query = '[.[] | select(.status | test("(in_progress)|(queued)|(requested)|(waiting)|(pending)")) | select(.number != ' + $currentRunNumber + ')] | length' - } else { - $query = '[.[] | select(.status | test("(in_progress)|(queued)|(requested)|(waiting)|(pending)"))] | length' - } - $count = gh run list -R $workflow.Repository -w $workflow.Name --json number,status -q $query - Write-Host $workflow.Repository $workflow.Name: $count runs in progress - if ($count -gt 0){ - return "true" - } - } - return "false" - } - - $result = Check-For-Ongoing-Runs - echo "result=$result" >> $env:GITHUB_OUTPUT - echo "Active runs: $result" \ No newline at end of file diff --git a/.github/workflows/server_checks.yml b/.github/workflows/server_checks.yml index 5db41a94..27b1e07d 100644 --- a/.github/workflows/server_checks.yml +++ b/.github/workflows/server_checks.yml @@ -161,8 +161,9 @@ jobs: retention-days: 7 check_workflow_runs: + name: Check if there are active workflow runs needs: docs - uses: ./.github/workflows/check-concurrent-workflows.yml + uses: ansys/pygranta/.github/workflows/check-concurrent-workflows.yml@main stop_vm: name: Stop Azure VM