-
Notifications
You must be signed in to change notification settings - Fork 89
59 lines (51 loc) · 1.81 KB
/
run_server_ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Helpful YAML parser to clarify YAML syntax:
# https://yaml-online-parser.appspot.com/
name: Run Server Code CI
on:
pull_request:
# Triggered by default activities (synchronize, opened, reopened) + labeled.
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
types: [labeled, synchronize, opened, reopened]
branches: ["main"]
paths:
- 'src/server/**'
- '.github/workflow/**'
- 'ci/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
check-ci-run-label:
name: Check ci:run label
runs-on: ubuntu-latest
steps:
- run: echo "Run on branch $BRANCH_NAME by $PR_AUTHOR"
env:
BRANCH_NAME: ${{ github.head_ref }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
- name: Fail if no ci:run label
if: ${{ !((github.event.pull_request.user.login == 'copybara-service[bot]') || contains(github.event.pull_request.labels.*.name, 'ci:run')) }}
run: exit 1
remove-ci-run-label:
name: Remove ci:run label
runs-on: ubuntu-latest
needs: check-ci-run-label
steps:
- name: remove-cirun
if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:run') }}
uses: actions/github-script@v5
with:
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'ci:run'
})
continue-on-error: true
run-formatting:
name: Formatting
needs: remove-ci-run-label
uses: ./.github/workflows/formatting.yml
with:
trigger-sha: ${{ github.event.pull_request.head.sha }}