Skip to content

Commit cca26b8

Browse files
authored
Merge branch 'develop' into parul/a4x
2 parents 96a1db8 + 06db73a commit cca26b8

134 files changed

Lines changed: 1733 additions & 435 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright 2025 "Google LLC"
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Check PR Description
16+
on:
17+
pull_request:
18+
types:
19+
- opened
20+
- edited
21+
- synchronize
22+
jobs:
23+
check-description:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
- name: Check PR description
29+
env:
30+
PR_BODY: ${{ github.event.pull_request.body }}
31+
run: |
32+
TEMPLATE_PATH=".github/pull_request_template.md"
33+
34+
if [ -f "$TEMPLATE_PATH" ]; then
35+
TEMPLATE_BODY=$(cat "$TEMPLATE_PATH")
36+
else
37+
TEMPLATE_BODY=""
38+
fi
39+
40+
# Function to normalize text: removes empty lines, trims leading/trailing whitespace, and removes carriage returns
41+
normalize_text() {
42+
echo -n "$1" | tr -d '\r' | awk 'NF' | awk '{$1=$1};1'
43+
}
44+
45+
# 1. Check if the PR body is empty or contains only whitespace
46+
if [ -z "$(echo "$PR_BODY" | tr -d '[:space:]')" ]; then
47+
echo "Error: PR description is empty or contains only whitespace."
48+
exit 1
49+
fi
50+
51+
# 2. Check if the PR body is identical to the template
52+
NORMALIZED_PR_BODY=$(normalize_text "$PR_BODY")
53+
NORMALIZED_TEMPLATE_BODY=$(normalize_text "$TEMPLATE_BODY")
54+
55+
if [[ "$NORMALIZED_PR_BODY" == "$NORMALIZED_TEMPLATE_BODY" ]]; then
56+
echo "Error: PR description only contains the template text. Please add a description of your changes."
57+
exit 1
58+
fi
59+
60+
# 3. Check if at least 10 characters have been added to the description
61+
# Use `diff` to isolate the added lines between the template and the PR body.
62+
ADDED_TEXT=$(diff --changed-group-format="%>" --unchanged-group-format="" <(echo "$NORMALIZED_TEMPLATE_BODY") <(echo "$NORMALIZED_PR_BODY") || true)
63+
ADDED_TEXT_LEN=${#ADDED_TEXT}
64+
65+
if [[ "$ADDED_TEXT_LEN" -lt 10 ]]; then
66+
echo "Error: PR description must contain at least 10 added characters."
67+
exit 1
68+
fi
69+
70+
echo "PR description check passed."

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ repos:
7474
files: 'tools/cloud-build/daily-tests/builds/.*\.yaml'
7575
pass_filenames: false
7676
require_serial: true
77+
- id: validate-daily-test-builds
78+
name: validate-daily-test-builds
79+
entry: tools/cloud-build/daily-tests/validate_daily_test_builds.py
80+
language: python
81+
language_version: python3
82+
additional_dependencies: ['pyyaml']
83+
files: 'tools/cloud-build/daily-tests/builds/.*\.(yaml|yml)'
84+
pass_filenames: true
85+
require_serial: true
7786
- id: pytest-check
7887
name: pytest-check
7988
entry: python -m pytest

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ install-dev-deps: warn-terraform-version warn-packer-version check-pre-commit ch
7373
go install honnef.co/go/tools/cmd/staticcheck@latest
7474
pip install -r community/modules/scheduler/schedmd-slurm-gcp-v6-controller/modules/slurm_files/scripts/requirements.txt
7575
pip install -r community/modules/scheduler/schedmd-slurm-gcp-v6-controller/modules/slurm_files/scripts/requirements-dev.txt
76-
pip install mypy
76+
pip install mypy==1.18.2
7777

7878

7979
clean:

0 commit comments

Comments
 (0)