Workflow-history #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Workflow-history" | |
on: | |
workflow_dispatch: | |
jobs: | |
check_workflow_runs: | |
name: Check if workflows run | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get previous workflow runs | |
id: get_workflow_runs | |
run: | | |
response=$(curl -s \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/check_workflow_runs.yml/runs?branch=main&status=in_progress") | |
echo "Response: $response" | |
runs=$(echo "$response" | jq '.total_count') | |
echo "runs=$runs" >> $GITHUB_OUTPUT | |
- name: Check if there are in-progress runs | |
run: | | |
if [ "${{ (steps.get_workflow_runs.outputs.runs) }}" -gt 0 ]; then | |
echo "There are previous runs in progress." | |
exit 1 | |
else | |
echo "No in-progress runs." | |
fi | |
- uses: actions/checkout@v4 | |
- name: Run the test powershell script | |
shell: pwsh | |
run: | | |
.\Scripts\test.ps1 |