-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (71 loc) · 2.9 KB
/
Copy pathpr-checks.yml
File metadata and controls
81 lines (71 loc) · 2.9 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
name: PR verification checks
on:
pull_request:
jobs:
check_commit_messages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Reject revertme / DO NOT MERGE commits
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
range="$BASE_SHA..$HEAD_SHA"
if git log --pretty=format:%s "$range" | grep -i -e '^revertme' -e '^revert me'; then
echo "::error::Merge request contains at least a commit starting with a 'revert me' tag. Fix it before merging."
exit 1
fi
if git log --pretty=format:%s "$range" | grep -i -e '^DO NOT MERGE'; then
echo "::error::Merge request contains at least a commit starting with a 'DO NOT MERGE' tag. Review it."
exit 1
fi
check_patches:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: '3'
- name: Validate Upstream-Status in added/modified patches
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: python ci_scripts/check_patch.py "$BASE_SHA" "$HEAD_SHA"
check_packages_yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: false
- name: Validate changed docs/packages/*.yaml and their build workflows
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
ret=0
for path in $(git diff --name-only --diff-filter=ACMR "$BASE_SHA" "$HEAD_SHA" -- 'docs/packages/*.yaml'); do
uv run --quiet ci_scripts/pending_versions.py --check "$(basename "$path" .yaml)" || ret=1
done
for path in $(git diff --name-only --diff-filter=ACMR "$BASE_SHA" "$HEAD_SHA" -- '.github/workflows/build-*.yml' '.github/workflows/test-*.yml'); do
package=$(sed -En 's/^[[:space:]]+package:[[:space:]]*([^ #]+).*/\1/p' "$path" | head -n1)
if [[ -z "$package" ]]; then
echo "::error file=$path::the setup job must call _setup.yml with a package: input"
ret=1
elif [[ ! -f "docs/packages/$package.yaml" ]]; then
echo "::error file=$path::docs/packages/$package.yaml does not exist; add it with the versions to build"
ret=1
fi
done
exit $ret