diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 0000000000..f3d297286e --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,20 @@ +name: cleanup-workflow + +on: + workflow_run: + workflows: + - "build" + types: ["requested"] + +jobs: + cancel-duplicated-workflow: + name: "Cancel duplicated workflow" + runs-on: ubuntu-latest + steps: + - uses: potiuk/cancel-workflow-runs@953e057dc81d3458935a18d1184c386b0f6b5738 # tested + name: "Cancel duplicate workflows" + with: + cancelMode: allDuplicates + token: ${{ secrets.GITHUB_TOKEN }} + sourceRunId: ${{ github.event.workflow_run.id }} + skipEventTypes: '["schedule"]' diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 7eef0267dd..8e92ea0ed7 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -15,10 +15,6 @@ jobs: flake8-py3: runs-on: ubuntu-latest steps: - - name: Cancel Previous Jobs - uses: styfle/cancel-workflow-action@0.7.0 - with: - access_token: ${{ github.token }} - uses: actions/checkout@v2 - name: Set up Python 3.8 uses: actions/setup-python@v2 @@ -188,10 +184,6 @@ jobs: options: --gpus all runs-on: [self-hosted, linux, x64, common] steps: - - name: Cancel Previous Self-hosted Runs - uses: styfle/cancel-workflow-action@0.7.0 - with: - access_token: ${{ github.token }} - uses: actions/checkout@v2 - name: apt install run: | diff --git a/.github/workflows/weekly-preview.yml b/.github/workflows/weekly-preview.yml index dddc03199c..bb68a0801d 100644 --- a/.github/workflows/weekly-preview.yml +++ b/.github/workflows/weekly-preview.yml @@ -6,6 +6,7 @@ on: jobs: packaging: + if: github.repository == 'Project-MONAI/MONAI' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2