From 0efac9245e0a9b2090d2449871fbbe84d468af3b Mon Sep 17 00:00:00 2001 From: Yiyao Wei Date: Mon, 6 Sep 2021 15:52:52 +0200 Subject: [PATCH] Use concurrency group to cancel workflows (#9540) * Use concurrency group to cancel workflows * Remove needs --- .github/workflows/cancel-stale-workflows.yml | 26 -------------------- .github/workflows/ci-docs-tests.yml | 4 +++ .github/workflows/ci-model-regression.yml | 18 +++----------- .github/workflows/continous-integration.yml | 4 +++ .github/workflows/documentation.yml | 5 ++++ .github/workflows/security-scans.yml | 15 +++-------- 6 files changed, 21 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/cancel-stale-workflows.yml diff --git a/.github/workflows/cancel-stale-workflows.yml b/.github/workflows/cancel-stale-workflows.yml deleted file mode 100644 index cd2e79d76799..000000000000 --- a/.github/workflows/cancel-stale-workflows.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Cleanup Duplicate Branches and PRs -on: - schedule: - - cron: '*/5 * * * *' - workflow_dispatch: - -jobs: - cancel-runs: - # Prevent forks from running this to be nice - if: github.repository == 'RasaHQ/rasa' - runs-on: ubuntu-latest - steps: - - uses: n1hility/cancel-previous-runs@v2 - with: - token: ${{ secrets.RASABOT_GITHUB_TOKEN }} - workflow: 351973 - - - name: Notify slack on failure - if: failure() && github.event_name == 'schedule' - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - uses: voxmedia/github-action-slack-notify-build@212e9f7a9ca33368c8dd879d6053972128258985 - with: - channel_id: ${{ secrets.SLACK_ALERTS_CHANNEL_ID }} - status: FAILED - color: warning diff --git a/.github/workflows/ci-docs-tests.yml b/.github/workflows/ci-docs-tests.yml index 0fb6af979e30..1fefa4cf2da8 100644 --- a/.github/workflows/ci-docs-tests.yml +++ b/.github/workflows/ci-docs-tests.yml @@ -8,6 +8,10 @@ on: pull_request: types: [opened, synchronize, labeled] +concurrency: + group: ci-docs-tests-${{ github.ref }} # branch or tag name + cancel-in-progress: true + env: DEFAULT_PYTHON_VERSION: '3.7' diff --git a/.github/workflows/ci-model-regression.yml b/.github/workflows/ci-model-regression.yml index 617ebebf5750..7b0e3329b3c4 100644 --- a/.github/workflows/ci-model-regression.yml +++ b/.github/workflows/ci-model-regression.yml @@ -10,27 +10,17 @@ on: pull_request: types: [opened, synchronize, labeled] +concurrency: + group: ci-model-regression-${{ github.ref }} # branch or tag name + cancel-in-progress: true + env: GKE_ZONE: us-central1 GCLOUD_VERSION: "318.0.0" jobs: - cleanup_runs: - name: Cancel old branch builds - runs-on: ubuntu-latest - if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" - - steps: - - name: Find and cancel old builds of this branch - uses: styfle/cancel-workflow-action@a40b8845c0683271d9f53dfcb887a7e181d3918b #0.9.0 - with: - access_token: "${{ secrets.GITHUB_TOKEN }}" - all_but_latest: true - ignore_sha: true - read_test_configuration: name: Reads tests configuration - needs: cleanup_runs if: "github.repository == 'RasaHQ/rasa' && contains(github.event.pull_request.labels.*.name, 'status:model-regression-tests')" runs-on: ubuntu-latest outputs: diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 75b4c45f7f38..b33cf2849891 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -8,6 +8,10 @@ on: - '*' pull_request: +concurrency: + group: continous-integration-${{ github.ref }} # branch or tag name + cancel-in-progress: true + # SECRETS # - GH_RELEASE_NOTES_TOKEN: personal access token of `rasabot` github account # (login for account in 1pw) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index a06d6950f891..a32516a27506 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -7,6 +7,11 @@ on: tags: - '**' +concurrency: + # group workflow runs based on the branch or the tag ref + group: documentation-${{ github.ref }} + cancel-in-progress: true + # SECRETS # - GH_DOCS_WRITE_KEY: generated locally, added to github repo (public key) # `ssh-keygen -t rsa -b 4096 -C "Github CI Docs Key" -N "" -f key` diff --git a/.github/workflows/security-scans.yml b/.github/workflows/security-scans.yml index a31f50af5564..43d3aa2398b7 100644 --- a/.github/workflows/security-scans.yml +++ b/.github/workflows/security-scans.yml @@ -4,6 +4,10 @@ on: pull_request: types: [opened, synchronize, labeled] +concurrency: + group: security-scans-${{ github.head_ref }} # head branch name + cancel-in-progress: true + jobs: changes: name: Check for file changes @@ -20,17 +24,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} filters: .github/change_filters.yml - cleanup_runs: - name: Cancel old branch builds - runs-on: ubuntu-latest - if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" - - steps: - - name: Find and cancel old builds of this branch - uses: styfle/cancel-workflow-action@a40b8845c0683271d9f53dfcb887a7e181d3918b - with: - access_token: "${{ secrets.GITHUB_TOKEN }}" - gitleaks: name: Detecting hardcoded secrets runs-on: ubuntu-latest