Skip to content

Instantly share code, notes, and snippets.

@NoNews
Created December 4, 2022 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NoNews/bdedf2560c92ecea2867d1c9084321f4 to your computer and use it in GitHub Desktop.
Save NoNews/bdedf2560c92ecea2867d1c9084321f4 to your computer and use it in GitHub Desktop.
import argparse
import os
parser = argparse.ArgumentParser("")
parser.add_argument('--target-branch', required=True)
args = parser.parse_args()
command = "git diff {target_branch} --name-status".format(target_branch=args.target_branch)
diffs = os.popen(command).read()
for current_file in diffs.splitlines():
operation = current_file[0]
current_file_name = str(current_file)[1:].strip()
if current_file_name.startswith("app_name/app/src/") and operation == 'A':
os.system("echo \"##teamcity[buildStatus text='Adding new files to app module is restricted']\"")
raise Exception("Adding new files to app module is restricted")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment