Skip to content

Commit

Permalink
Only check version and date when spec changed
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
joshuagl authored and trishankatdatadog committed Jul 1, 2021
1 parent 9b83400 commit 17213ba
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,27 @@ def main():
header are higher than in the master branch, i.e. were bumped. """

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

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

# Only proceed if the spec itself was changed
git_run = subprocess.run(shlex.split(
"git diff --name-only origin/master {}".format(current_branch)),
capture_output=True, check=True, text=True)
modified_files = git_run.stdout.split() or []

if SPEC_NAME not in modified_files:
print("*"*68)
print("{} not modified, skipping version and date check.".format(SPEC_NAME))
print("*"*68)
return

# Read the first few lines from the updated specification document and
# extract date and version from spec file header in the current branch
spec_head = get_spec_head()
Expand Down

0 comments on commit 17213ba

Please sign in to comment.