diff --git a/.github/workflows/cancel-running-workflows.yaml b/.github/workflows/cancel-running-workflows.yaml deleted file mode 100644 index 10c9c7f5b1..0000000000 --- a/.github/workflows/cancel-running-workflows.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Cancel Workflow Runs - -on: - pull_request: - types: [ synchronize ] - -jobs: - cancel-runs: - runs-on: ubuntu-latest - steps: - - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT - id: extract_branch - - name: Get Workflow Runs - id: get_runs - uses: actions/github-script@v4 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { data: runs } = await github.actions.listRepoWorkflowRuns({ - owner: context.repo.owner, - repo: context.repo.repo, - per_page: 100, - status: 'in_progress' // Filter for in-progress runs - }); - return runs; - - - name: Cancel Workflow Runs - if: ${{ always() }} - run: | - for run in "${{ steps.get_runs.outputs.runtimes }}"; do - # Cancel runs based on conditions - # Example: cancel runs triggered by the main branch - if [[ $run.branch == ${{ steps.extract_branch.outputs.branch }} ]]; then - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/${{ github.repository }}/actions/runs/${run.id}/cancel - fi - done diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index eae10acc4d..05a6b4270d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,6 +7,10 @@ on: pull_request: types: [ opened, synchronize, reopened ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: checks: name: Various checks