Skip to content

Commit

Permalink
fix(release notes): use 40px user avatar (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Jul 17, 2024
1 parent 29965b0 commit 62354fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
14 changes: 8 additions & 6 deletions action/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from dotenv import load_dotenv
import requests

# global variables
AVATAR_SIZE = 40

# Load the environment variables from the Environment File
load_dotenv()

Expand Down Expand Up @@ -306,21 +309,20 @@ def process_release_body(release_body: str) -> str:
# sort contributors by contributions count
contributors = dict(sorted(contributors.items(), key=lambda item: (-item[1]['contributions'], item[0])))

processed_body += '\n---\n'
processed_body += '\n\n---\n'
processed_body += '## Contributors\n'
for contributor, details in contributors.items():
# add the contributor's avatar
# use <img> tag to ensure the image is the correct size of 50x50
# unchanged avatars cannot use the size query
# use <img> tag to ensure the image is the correct size as unchanged avatars cannot use the size query
processed_body += (
f'<a href="{details["url"]}" '
'target="_blank" '
'rel="external noopener noreferrer" '
f'aria-label="GitHub profile of contributor, {contributor}" '
'>'
f'<img src="{details["url"]}.png?size=50" '
'width="50" '
'height="50" '
f'<img src="{details["url"]}.png?size={AVATAR_SIZE}" '
f'width="{AVATAR_SIZE}" '
f'height="{AVATAR_SIZE}" '
f'alt="{contributor}" '
f'title="{contributor}: {details["contributions"]} '
f'{"merges" if details["contributions"] > 1 else "merge"}" '
Expand Down
3 changes: 2 additions & 1 deletion tests/data/expected_release_notes_sample_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@

**Full Changelog**: https://github.com/LizardByte/Sunshine/compare/v0.23.1...2024.713.195308


---
## Contributors
<a href="https://github.com/ReenigneArcher" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, ReenigneArcher" ><img src="https://github.com/ReenigneArcher.png?size=50" width="50" height="50" alt="ReenigneArcher" title="ReenigneArcher: 59 merges" ></a><a href="https://github.com/dependabot" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, dependabot" ><img src="https://github.com/dependabot.png?size=50" width="50" height="50" alt="dependabot" title="dependabot: 41 merges" ></a><a href="https://github.com/Hazer" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, Hazer" ><img src="https://github.com/Hazer.png?size=50" width="50" height="50" alt="Hazer" title="Hazer: 6 merges" ></a><a href="https://github.com/LizardByte-bot" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, LizardByte-bot" ><img src="https://github.com/LizardByte-bot.png?size=50" width="50" height="50" alt="LizardByte-bot" title="LizardByte-bot: 5 merges" ></a><a href="https://github.com/gschintgen" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, gschintgen" ><img src="https://github.com/gschintgen.png?size=50" width="50" height="50" alt="gschintgen" title="gschintgen: 4 merges" ></a><a href="https://github.com/TimmyOVO" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, TimmyOVO" ><img src="https://github.com/TimmyOVO.png?size=50" width="50" height="50" alt="TimmyOVO" title="TimmyOVO: 3 merges" ></a><a href="https://github.com/tez011" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, tez011" ><img src="https://github.com/tez011.png?size=50" width="50" height="50" alt="tez011" title="tez011: 3 merges" ></a><a href="https://github.com/BeeLeDev" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, BeeLeDev" ><img src="https://github.com/BeeLeDev.png?size=50" width="50" height="50" alt="BeeLeDev" title="BeeLeDev: 2 merges" ></a><a href="https://github.com/c3m3gyanesh" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, c3m3gyanesh" ><img src="https://github.com/c3m3gyanesh.png?size=50" width="50" height="50" alt="c3m3gyanesh" title="c3m3gyanesh: 2 merges" ></a><a href="https://github.com/cathyjf" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, cathyjf" ><img src="https://github.com/cathyjf.png?size=50" width="50" height="50" alt="cathyjf" title="cathyjf: 2 merges" ></a><a href="https://github.com/cfalas" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, cfalas" ><img src="https://github.com/cfalas.png?size=50" width="50" height="50" alt="cfalas" title="cfalas: 2 merges" ></a><a href="https://github.com/cgarst" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, cgarst" ><img src="https://github.com/cgarst.png?size=50" width="50" height="50" alt="cgarst" title="cgarst: 2 merges" ></a><a href="https://github.com/cgutman" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, cgutman" ><img src="https://github.com/cgutman.png?size=50" width="50" height="50" alt="cgutman" title="cgutman: 2 merges" ></a><a href="https://github.com/chewi" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, chewi" ><img src="https://github.com/chewi.png?size=50" width="50" height="50" alt="chewi" title="chewi: 2 merges" ></a><a href="https://github.com/hgaiser" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, hgaiser" ><img src="https://github.com/hgaiser.png?size=50" width="50" height="50" alt="hgaiser" title="hgaiser: 2 merges" ></a><a href="https://github.com/ns6089" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, ns6089" ><img src="https://github.com/ns6089.png?size=50" width="50" height="50" alt="ns6089" title="ns6089: 2 merges" ></a><a href="https://github.com/skryvel" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, skryvel" ><img src="https://github.com/skryvel.png?size=50" width="50" height="50" alt="skryvel" title="skryvel: 2 merges" ></a><a href="https://github.com/xanderfrangos" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, xanderfrangos" ><img src="https://github.com/xanderfrangos.png?size=50" width="50" height="50" alt="xanderfrangos" title="xanderfrangos: 2 merges" ></a><a href="https://github.com/ABeltramo" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, ABeltramo" ><img src="https://github.com/ABeltramo.png?size=50" width="50" height="50" alt="ABeltramo" title="ABeltramo: 1 merge" ></a><a href="https://github.com/mariotaku" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, mariotaku" ><img src="https://github.com/mariotaku.png?size=50" width="50" height="50" alt="mariotaku" title="mariotaku: 1 merge" ></a>
<a href="https://github.com/ReenigneArcher" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, ReenigneArcher" ><img src="https://github.com/ReenigneArcher.png?size=40" width="40" height="40" alt="ReenigneArcher" title="ReenigneArcher: 59 merges" ></a><a href="https://github.com/dependabot" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, dependabot" ><img src="https://github.com/dependabot.png?size=40" width="40" height="40" alt="dependabot" title="dependabot: 41 merges" ></a><a href="https://github.com/Hazer" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, Hazer" ><img src="https://github.com/Hazer.png?size=40" width="40" height="40" alt="Hazer" title="Hazer: 6 merges" ></a><a href="https://github.com/LizardByte-bot" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, LizardByte-bot" ><img src="https://github.com/LizardByte-bot.png?size=40" width="40" height="40" alt="LizardByte-bot" title="LizardByte-bot: 5 merges" ></a><a href="https://github.com/gschintgen" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, gschintgen" ><img src="https://github.com/gschintgen.png?size=40" width="40" height="40" alt="gschintgen" title="gschintgen: 4 merges" ></a><a href="https://github.com/TimmyOVO" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, TimmyOVO" ><img src="https://github.com/TimmyOVO.png?size=40" width="40" height="40" alt="TimmyOVO" title="TimmyOVO: 3 merges" ></a><a href="https://github.com/tez011" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, tez011" ><img src="https://github.com/tez011.png?size=40" width="40" height="40" alt="tez011" title="tez011: 3 merges" ></a><a href="https://github.com/BeeLeDev" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, BeeLeDev" ><img src="https://github.com/BeeLeDev.png?size=40" width="40" height="40" alt="BeeLeDev" title="BeeLeDev: 2 merges" ></a><a href="https://github.com/c3m3gyanesh" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, c3m3gyanesh" ><img src="https://github.com/c3m3gyanesh.png?size=40" width="40" height="40" alt="c3m3gyanesh" title="c3m3gyanesh: 2 merges" ></a><a href="https://github.com/cathyjf" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, cathyjf" ><img src="https://github.com/cathyjf.png?size=40" width="40" height="40" alt="cathyjf" title="cathyjf: 2 merges" ></a><a href="https://github.com/cfalas" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, cfalas" ><img src="https://github.com/cfalas.png?size=40" width="40" height="40" alt="cfalas" title="cfalas: 2 merges" ></a><a href="https://github.com/cgarst" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, cgarst" ><img src="https://github.com/cgarst.png?size=40" width="40" height="40" alt="cgarst" title="cgarst: 2 merges" ></a><a href="https://github.com/cgutman" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, cgutman" ><img src="https://github.com/cgutman.png?size=40" width="40" height="40" alt="cgutman" title="cgutman: 2 merges" ></a><a href="https://github.com/chewi" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, chewi" ><img src="https://github.com/chewi.png?size=40" width="40" height="40" alt="chewi" title="chewi: 2 merges" ></a><a href="https://github.com/hgaiser" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, hgaiser" ><img src="https://github.com/hgaiser.png?size=40" width="40" height="40" alt="hgaiser" title="hgaiser: 2 merges" ></a><a href="https://github.com/ns6089" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, ns6089" ><img src="https://github.com/ns6089.png?size=40" width="40" height="40" alt="ns6089" title="ns6089: 2 merges" ></a><a href="https://github.com/skryvel" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, skryvel" ><img src="https://github.com/skryvel.png?size=40" width="40" height="40" alt="skryvel" title="skryvel: 2 merges" ></a><a href="https://github.com/xanderfrangos" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, xanderfrangos" ><img src="https://github.com/xanderfrangos.png?size=40" width="40" height="40" alt="xanderfrangos" title="xanderfrangos: 2 merges" ></a><a href="https://github.com/ABeltramo" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, ABeltramo" ><img src="https://github.com/ABeltramo.png?size=40" width="40" height="40" alt="ABeltramo" title="ABeltramo: 1 merge" ></a><a href="https://github.com/mariotaku" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, mariotaku" ><img src="https://github.com/mariotaku.png?size=40" width="40" height="40" alt="mariotaku" title="mariotaku: 1 merge" ></a>
3 changes: 2 additions & 1 deletion tests/data/expected_release_notes_sample_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## New Contributors
* [@LizardByte](https://github.com/LizardByte) made their first contribution


---
## Contributors
<a href="https://github.com/LizardByte" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, LizardByte" ><img src="https://github.com/LizardByte.png?size=50" width="50" height="50" alt="LizardByte" title="LizardByte: 2 merges" ></a><a href="https://github.com/dependabot" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, dependabot" ><img src="https://github.com/dependabot.png?size=50" width="50" height="50" alt="dependabot" title="dependabot: 1 merge" ></a>
<a href="https://github.com/LizardByte" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, LizardByte" ><img src="https://github.com/LizardByte.png?size=40" width="40" height="40" alt="LizardByte" title="LizardByte: 2 merges" ></a><a href="https://github.com/dependabot" target="_blank" rel="external noopener noreferrer" aria-label="GitHub profile of contributor, dependabot" ><img src="https://github.com/dependabot.png?size=40" width="40" height="40" alt="dependabot" title="dependabot: 1 merge" ></a>

0 comments on commit 62354fc

Please sign in to comment.