Skip to content

Commit

Permalink
Add a step summary for the event publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Jan 23, 2024
1 parent be8a98c commit 0f3e216
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/publish_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,29 @@ def main(event_dir: pathlib.Path, failure_path: pathlib.Path) -> None:
print(f'Found {MILESTONE!r} milestone {milestone.number}')

failures = {}
event_summary = []
for issue in repo.get_issues(milestone=milestone):
try:
event = parse_issue(issue)
except Exception as e:
print(f'::error title=Failed to parse event {issue.title}::{e}')
failures[issue.number] = str(e)
else:
event_summary.append(
f'- {event["title"]} on {event["date"]} at {event["startTime"]}')
print(f'Parsed event: {issue.title}')
with (event_dir / post_to_filename(event)).open('wb') as f:
frontmatter.dump(event, f)

summary = f'Parsed **{len(event_summary)}** issue(s) into event posts:'
if 'GITHUB_STEP_SUMMARY' in os.environ:
with open(os.environ['GITHUB_STEP_SUMMARY'], 'w+') as f:
f.write('# Event publishing\n')
f.write(f'{summary}\n')
f.write('\n'.join(event_summary))
else:
print(summary)

with open(failure_path, 'w') as f:
json.dump(failures, f)

Expand Down

0 comments on commit 0f3e216

Please sign in to comment.