瀏覽代碼

Use concurrency to cancel duplicate workflow runs

Docs: https://docs.github.com/en/actions/using-jobs/using-concurrency
arkon 2 年之前
父節點
當前提交
b0da0753d9

+ 4 - 0
.github/workflows/build_pull_request.yml

@@ -5,6 +5,10 @@ on:
       - '**.md'
       - 'app/src/main/res/**/strings.xml'
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+  cancel-in-progress: true
+
 permissions:
   contents: read
 

+ 4 - 6
.github/workflows/build_push.yml

@@ -6,18 +6,16 @@ on:
     tags:
       - v*
 
+concurrency:
+  group: ${{ github.workflow }}
+  cancel-in-progress: true
+
 jobs:
   build:
     name: Build app
     runs-on: ubuntu-latest
 
     steps:
-      - name: Cancel previous runs
-        uses: styfle/[email protected]
-        with:
-          access_token: ${{ github.token }}
-          all_but_latest: true
-
       - name: Clone repo
         uses: actions/checkout@v3
 

+ 0 - 16
.github/workflows/cancel_pull_request.yml

@@ -1,16 +0,0 @@
-name: Cancel old pull request workflows
-
-on:
-  workflow_run:
-    workflows: ["PR build check"]
-    types:
-      - requested
-
-jobs:
-  cancel:
-    runs-on: ubuntu-latest
-    steps:
-    - uses: styfle/[email protected]
-      with:
-        all_but_latest: true
-        workflow_id: ${{ github.event.workflow.id }}