Skip to content

Commit

Permalink
general robustness improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cpfiffer committed Oct 21, 2024
1 parent 4ba6a14 commit 2dae8b4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/generate-scp-entry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
- name: Create and switch to gh-pages branch
run: |
git checkout -b gh-pages
git pull origin gh-pages || true
git fetch origin gh-pages
git checkout -B gh-pages origin/gh-pages
- name: Copy generated files
run: |
Expand All @@ -51,4 +51,4 @@ jobs:
run: |
git add -f scp/entries
git commit -m "Add new SCP entry and update index" || echo "No changes to commit"
git push origin gh-pages
git push origin gh-pages || git pull --rebase origin gh-pages && git push origin gh-pages
43 changes: 24 additions & 19 deletions scp/scp-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,30 @@
# Make it
os.makedirs(dir)


# Call the api
entry = create_completion(SCP, scp_prompt())

# Save it to disk
entry.save(scp_dir)
print(f"Entry saved to {entry.filepath(scp_dir)}")

# Save the entry to HTML
html_content = entry.to_html()
html_path = entry.html_filepath(scp_dir)
with open(html_path, "w") as f:
f.write(html_content)
print(f"HTML saved to {html_path}")

# Review it
review = create_completion(Reviewer, reviewer_prompt(entry))

# Save it to disk
review_path = os.path.join(review_dir, f"{entry.item_number}.txt")
review.save(review_path)
print(f"Review saved to {review_path}")
# Check if the entry already exists
if os.path.exists(entry.filepath(scp_dir)) or os.path.exists(entry.html_filepath(scp_dir)):
print(f"Entry {entry.item_number} already exists. Skipping.")
else:
# Save it to disk
entry.save(scp_dir)
print(f"Entry saved to {entry.filepath(scp_dir)}")

# Save the entry to HTML
html_content = entry.to_html()
html_path = entry.html_filepath(scp_dir)
with open(html_path, "w") as f:
f.write(html_content)
print(f"HTML saved to {html_path}")

# Review it
review = create_completion(Reviewer, reviewer_prompt(entry))

# Save it to disk
review_path = os.path.join(review_dir, f"{entry.item_number}.txt")
review.save(review_path)
print(f"Review saved to {review_path}")

print("SCP entry generation complete.")

0 comments on commit 2dae8b4

Please sign in to comment.