Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Setup github api to be used to get the commit_time when the passed in…
… one fails to parse, although printing a warning.
  • Loading branch information
LoopedBard3 committed Sep 30, 2022
commit 6932d0de2c5619f08a9e0a87ee91c4a65088e7ca
8 changes: 6 additions & 2 deletions scripts/ci_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,12 @@ def __main(args: list) -> int:
dotnet_version = dotnet.get_dotnet_version(target_framework_moniker, args.cli) if args.dotnet_versions == [] else args.dotnet_versions[0]
commit_sha = dotnet.get_dotnet_sdk(target_framework_moniker, args.cli) if args.commit_sha is None else args.commit_sha
if(args.commit_time is not None):
parsed_timestamp = datetime.datetime.strptime(args.commit_time, '%Y-%m-%d %H:%M:%S %z').astimezone(datetime.timezone.utc)
source_timestamp = parsed_timestamp.strftime('%Y-%m-%dT%H:%M:%SZ')
try:
parsed_timestamp = datetime.datetime.strptime(args.commit_time, '%Y-%m-%d %H:%M:%S %z').astimezone(datetime.timezone.utc)
source_timestamp = parsed_timestamp.strftime('%Y-%m-%dT%H:%M:%SZ')
except ValueError:
getLogger().warning('Invalid commit_time format. Please use YYYY-MM-DD HH:MM:SS +/-HHMM. Attempting to get commit time from api.github.com.')
source_timestamp = dotnet.get_commit_date(target_framework_moniker, commit_sha, repo_url)
else:
source_timestamp = dotnet.get_commit_date(target_framework_moniker, commit_sha, repo_url)

Expand Down