add Python script to create artifact in workflow

This commit is contained in:
jessiebroke 2023-11-29 02:43:27 -05:00
parent 6929185bf9
commit 88faeafada
No known key found for this signature in database
GPG Key ID: D901DC638A938F8C

28
.github/scripts/restore_labels.py vendored Normal file
View File

@ -0,0 +1,28 @@
import os
import requests
import json
# Replace with your GitHub username, organization, repository, and personal access token
username = "JessieBroke"
organization = "codex-storage"
repository = "nim-codex"
token = os.getenv("GH_PAT")
# GitHub API endpoint for listing issue events
api_url = f"https://api.github.com/repos/{organization}/{repository}/issues/events"
# Fetch issue events
response = requests.get(api_url, headers={"Authorization": f"Bearer {token}"})
events = response.json()
# Save events to a JSON file
with open("issue_events.json", "w") as file:
json.dump(events, file)
# Restore labels based on deletion events
for event in events:
if event["event"] == "label":
label_name = event["label"]["name"]
# Restore the label using your preferred method (GitHub API, gh CLI, etc.)
print(f"Restoring label: {label_name}")
# Add logic here to restore the label using the GitHub API or other methods