Skip to content

Commit 17213ba

Browse files
joshuagltrishankatdatadog
authored andcommitted
Only check version and date when spec changed
There are now several files in the repository which can be changed without bumping the version and date in the spec. Update check_release.py to check whether the spec itself has been altered before checking version and date have been increased. Signed-off-by: Joshua Lock <[email protected]>
1 parent 9b83400 commit 17213ba

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

check_release.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,27 @@ def main():
8888
header are higher than in the master branch, i.e. were bumped. """
8989

9090
# Check that the current branch is based off of the master branch
91+
current_branch = os.environ["GITHUB_REF"].lstrip("refs/")
9192
try:
9293
subprocess.run(
9394
shlex.split("git merge-base --is-ancestor origin/master {}".format(
94-
os.environ["GITHUB_REF"].lstrip("refs/"))), check=True)
95+
current_branch)), check=True)
9596

9697
except subprocess.CalledProcessError as e:
9798
raise SpecError("make sure the current branch is based off of master")
9899

100+
# Only proceed if the spec itself was changed
101+
git_run = subprocess.run(shlex.split(
102+
"git diff --name-only origin/master {}".format(current_branch)),
103+
capture_output=True, check=True, text=True)
104+
modified_files = git_run.stdout.split() or []
105+
106+
if SPEC_NAME not in modified_files:
107+
print("*"*68)
108+
print("{} not modified, skipping version and date check.".format(SPEC_NAME))
109+
print("*"*68)
110+
return
111+
99112
# Read the first few lines from the updated specification document and
100113
# extract date and version from spec file header in the current branch
101114
spec_head = get_spec_head()

0 commit comments

Comments
 (0)