From 5c9b3fc1c1c59184842c9fe1d666188c5f69adfa Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Wed, 4 Dec 2024 14:27:58 +0700 Subject: [PATCH] ci: remove manage runs workflow (#2325) --- .github/workflows/manage-runs.yml | 47 -------------------- .github/workflows/prebuild-devcontainers.yml | 2 +- .github/workflows/tests-build-image.yml | 1 + .github/workflows/tests-build-js.yml | 1 + .github/workflows/tests-codeql.yml | 1 + .github/workflows/tests-js-package.yml | 2 + .github/workflows/tests-rs-package.yml | 1 + 7 files changed, 7 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/manage-runs.yml diff --git a/.github/workflows/manage-runs.yml b/.github/workflows/manage-runs.yml deleted file mode 100644 index 29bc43aa53..0000000000 --- a/.github/workflows/manage-runs.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Manage runs -on: - pull_request: - types: - - closed - -jobs: - cancel-merged-or-closed-pr-runs: - name: Cancel runs for merged or closed PRs - runs-on: ubuntu-24.04 - steps: - - uses: octokit/request-action@v2.x - id: get_active_workflows - with: - route: GET /repos/{owner}/{repo}/actions/runs?status=in_progress&event=pull_request - owner: dashpay - repo: platform - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract running workflow ids - id: extract_workflow_ids - run: | - current_branch=${GITHUB_HEAD_REF} - - # loop thru the workflows found & filter out ones that are not on PRs pointing to this branch - workflow_ids=$(echo '${{ steps.get_active_workflows.outputs.data }}' | \ - jq '.workflow_runs | map({id, head_branch})' | \ - jq 'map(select(.head_branch == "'$current_branch'")) | map(.id)' | \ - jq 'join(",")') - - # strip the wrapping quote marks before passing to next step - echo 'WORKFLOW_IDS='$(echo $workflow_ids | tr -d '"') >> $GITHUB_ENV - - - name: Cancel active workflow runs - run: | - for id in ${WORKFLOW_IDS//,/ } - do - echo "Cancelling workflow with id: $id" - - # use curl here as I have no idea how to use a github action in a loop - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - https://api.github.com/repos/${{ github.repository }}/actions/runs/$id/cancel - done diff --git a/.github/workflows/prebuild-devcontainers.yml b/.github/workflows/prebuild-devcontainers.yml index c7d4ee28f0..38a1ecd403 100644 --- a/.github/workflows/prebuild-devcontainers.yml +++ b/.github/workflows/prebuild-devcontainers.yml @@ -19,7 +19,7 @@ jobs: build: name: Build and push devcontainer runs-on: ubuntu-24.04 - timeout-minutes: 60 + timeout-minutes: 240 steps: - name: Checkout repo uses: actions/checkout@v4 diff --git a/.github/workflows/tests-build-image.yml b/.github/workflows/tests-build-image.yml index dc6efffa47..e14b7c1cf8 100644 --- a/.github/workflows/tests-build-image.yml +++ b/.github/workflows/tests-build-image.yml @@ -18,6 +18,7 @@ jobs: build-image: name: Build ${{ inputs.name }} image runs-on: ubuntu-24.04 + timeout-minutes: 30 steps: - name: Check out repo uses: actions/checkout@v4 diff --git a/.github/workflows/tests-build-js.yml b/.github/workflows/tests-build-js.yml index 1c73612e22..a36bd91e2c 100644 --- a/.github/workflows/tests-build-js.yml +++ b/.github/workflows/tests-build-js.yml @@ -5,6 +5,7 @@ jobs: build-js: name: Build JS runs-on: ubuntu-24.04 + timeout-minutes: 10 steps: - uses: softwareforgood/check-artifact-v4-existence@v0 id: check-artifact diff --git a/.github/workflows/tests-codeql.yml b/.github/workflows/tests-codeql.yml index ed972e6d9c..9ed7351bf7 100644 --- a/.github/workflows/tests-codeql.yml +++ b/.github/workflows/tests-codeql.yml @@ -5,6 +5,7 @@ jobs: codeql: name: Run Code QL runs-on: ubuntu-24.04 + timeout-minutes: 15 permissions: actions: read contents: read diff --git a/.github/workflows/tests-js-package.yml b/.github/workflows/tests-js-package.yml index 681c27b560..a2bf39a47b 100644 --- a/.github/workflows/tests-js-package.yml +++ b/.github/workflows/tests-js-package.yml @@ -18,6 +18,7 @@ jobs: lint: name: Linting runs-on: ubuntu-24.04 + timeout-minutes: 5 permissions: id-token: write contents: read @@ -40,6 +41,7 @@ jobs: test: name: Tests runs-on: ubuntu-24.04 + timeout-minutes: 15 permissions: id-token: write contents: read diff --git a/.github/workflows/tests-rs-package.yml b/.github/workflows/tests-rs-package.yml index 3696e7e9db..7730485c62 100644 --- a/.github/workflows/tests-rs-package.yml +++ b/.github/workflows/tests-rs-package.yml @@ -110,6 +110,7 @@ jobs: detect_structure_changes: name: Detect immutable structure changes + timeout-minutes: 10 runs-on: ubuntu-24.04 # FIXME: as we use `gh pr view` below, this check can only # run on pull requests. We should find a way to run it