Enhance the CI with label (#10)

* Running a workflow on labeling

* Add the function to cancel the progressing CI

* Separate the group by each labels

* Add comments

* Runs the CI when merged into main branch
This commit is contained in:
Pao Sheng
2024-03-14 11:59:47 +08:00
committed by GitHub
parent 98e6d920d1
commit 72f25bc2c4
+11 -4
View File
@@ -5,19 +5,26 @@ name: AI Service CI
on:
push:
branches: [ "main" ]
branches: [ main ]
pull_request:
branches: [ "main" ]
types: [ labeled ]
permissions:
contents: read
concurrency:
# avoid mis-canceling the ci runs while other labels are added to the PR, so we add the label name as the condition
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.label.name == 'ci/ai-service' && github.event.number || github.sha }}
cancel-in-progress: true
defaults:
run:
working-directory: wren-ai-service
run:
working-directory: wren-ai-service
jobs:
ci:
if: ${{ github.event.label.name == 'ci/ai-service' || github.event_name == 'push' && github.ref == 'refs/heads/main' }}
strategy:
fail-fast: false
matrix: