Skip to content

Commit

Permalink
Merge pull request #6 from yibo-long/restrict-trigger
Browse files Browse the repository at this point in the history
Only trigger based on trigger-path is specified
  • Loading branch information
yibo-long authored Feb 15, 2024
2 parents 8fc5d69 + 6a15550 commit 73f6548
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/scripts/create-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import yaml

# Required.
CIRCLE_CONTINUATION_KEY = os.environ["CIRCLE_CONTINUATION_KEY"]
CIRCLECI_DOMAIN = os.environ["CIRCLECI_DOMAIN"]
PROJECT_CONFIG_PATH = os.environ["PROJECT_CONFIG_PATH"]
CIRCLE_CONTINUATION_KEY = os.environ['CIRCLE_CONTINUATION_KEY']
CIRCLECI_DOMAIN = os.environ['CIRCLECI_DOMAIN']
PROJECT_CONFIG_PATH = os.environ['PROJECT_CONFIG_PATH']
HEADER_APPLICATION_JSON = 'application/json'


def checkout(revision):
Expand Down Expand Up @@ -94,8 +95,8 @@ def send_continuation(config, changes):
}
},
headers={
'Content-Type': 'application/json',
'Accept': 'application/json',
'Content-Type': HEADER_APPLICATION_JSON,
'Accept': HEADER_APPLICATION_JSON,
}
)
print(res)
Expand All @@ -121,12 +122,13 @@ def create_config(head, base):
# to that is just the first commit as patch.
base = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'

print('Comparing {}...{}'.format(base, head))
changes = changed_files(base, head)
additional_trigger_path = os.environ.get('ADDITIONAL_TRIGGER_PATH', '')
if additional_trigger_path:
print('Adding additional path {}'.format(additional_trigger_path))
changes.append(additional_trigger_path)
print('Using additional path {} only'.format(additional_trigger_path))
changes = [additional_trigger_path]
else:
print('Comparing {}...{}'.format(base, head))
changes = changed_files(base, head)
print(changes)
config_paths = scan_configs()
final_config = {
Expand Down

0 comments on commit 73f6548

Please sign in to comment.