Skip to content

Commit

Permalink
attempt to update the nfr list
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Jul 31, 2024
1 parent 412f1a0 commit caae8f5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/deploy-documents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ jobs:
wget -O overrides/fanart.md \
https://raw.githubusercontent.com/phalcon/assets/master/phalcon/fanart-fragment.html
- name: Update NFR list
run: |
python ./update-nfr.py
- name: Determine versioning parameters
id: determine-versioning
run: |
Expand Down
47 changes: 47 additions & 0 deletions update-nfr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import requests
import json

print("Getting NFR Reactions")

result = {}

url = f"{comments}{i}"
headers = {
'Accept': 'application/vnd.github.squirrel-girl-preview+json',
'User-Agent': 'Phalcon Agent'
}

response = requests.get(url, headers=headers)
content = response.text

print(f"Got content {i}")
data = json.loads(content)

for comment in data:
id = comment.get('id', '')
url = comment.get('html_url', '')
body = comment.get('body', '')
reactions = comment.get('reactions', {})
plusone = reactions.get('+1', '')

body = body.split('\n')[0].replace('\r', '').replace('\r\n', '')
plusone = f"{int(plusone):03}"
result[f"{plusone}-{id}"] = {
'reaction': plusone,
'body': f"[{body}]({url})"
}

print("Sorting Results")
sorted_result = dict(sorted(result.items(), key=lambda item: item[0], reverse=True))

print("Creating Content")
output = "| Votes | Description |\n"
output += "|--------|-------------------------|\n"
for item in sorted_result.values():
output += f"| {item['reaction']} | {item['body']} |\n"

output += "\n"

file_name = './docs/new-feature-request-list.md'
with open(file_name, 'a') as file:
file.write(output)

0 comments on commit caae8f5

Please sign in to comment.