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 5753e00
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/publish_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,27 @@ def main(event_dir: pathlib.Path, failure_path: pathlib.Path) -> None:
print(f'Found {MILESTONE!r} milestone {milestone.number}')

failures = {}
count = 0
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:
count += 1
print(f'Parsed event: {issue.title}')
with (event_dir / post_to_filename(event)).open('wb') as f:
frontmatter.dump(event, f)

summary = f'Parsed **{count}** 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')
else:
print(summary)

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

Expand Down

0 comments on commit 5753e00

Please sign in to comment.