From 7d15ec7fe20b07180f5dc3f4b580e2cba37c5b9e Mon Sep 17 00:00:00 2001 From: BoxiangW <45734921+BoxiangW@users.noreply.github.com> Date: Fri, 4 Feb 2022 15:04:55 +0800 Subject: [PATCH] Update github actions (#205) --- .github/workflows/PR_CI.yml | 15 ++++++++++++--- .github/workflows/close_inactive.yml | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/PR_CI.yml b/.github/workflows/PR_CI.yml index dc0685af6..173677b25 100644 --- a/.github/workflows/PR_CI.yml +++ b/.github/workflows/PR_CI.yml @@ -3,6 +3,15 @@ name: Pull Request CI and Build on: pull_request jobs: + cancel_previous_workflow: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false && github.base_ref == 'main' && github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + assign_reviewer: name: Assign Reviewer for PR runs-on: ubuntu-latest @@ -15,7 +24,7 @@ jobs: build: name: Build and Test Colossal-AI if: ${{ always() }} && github.event.pull_request.draft == false && github.base_ref == 'main' && github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' - needs: [assign_reviewer] + needs: [cancel_previous_workflow, assign_reviewer] runs-on: [self-hosted, gpu] container: image: nvcr.io/nvidia/pytorch:21.07-py3 @@ -43,8 +52,8 @@ jobs: format_check: name: Format Check - if: ${{ always() }} && github.event.pull_request.draft == false && github.base_ref == 'main' && github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' - needs: [assign_reviewer, build] + if: github.event.pull_request.draft == false && github.base_ref == 'main' && github.head_ref == 'develop' && github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' + needs: [build] runs-on: ubuntu-latest steps: - name: Checkout repo diff --git a/.github/workflows/close_inactive.yml b/.github/workflows/close_inactive.yml index 66c7bd461..988d9e3bc 100644 --- a/.github/workflows/close_inactive.yml +++ b/.github/workflows/close_inactive.yml @@ -5,6 +5,7 @@ on: jobs: close-issues: + if: github.event.pull_request.draft == false && github.base_ref == 'main' && github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' runs-on: ubuntu-latest permissions: issues: write