Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion Fix ]GitHub Action Fails Due to Unsupported Encoding in check_images_in_pr.py line 67 #226

Merged
merged 5 commits into from
Feb 9, 2025

Conversation

richarddushime
Copy link
Contributor

The GitHub Action for checking images in a pull request fails with the following error:

AssertionError: unsupported encoding: none
Error: Process completed with exit code 1.

The issue occurs in scripts/webp_conversion/check_images_in_pr.py, specifically when trying to decode file contents using contents.decoded_content.decode('utf-8', errors='ignore'). The script assumes that all files retrieved via repo.get_contents(filename, ref=pr.head.sha) will have base64 encoding, but some files are returned with encoding: none, leading to an assertion error.

The majority of the PRs were failing with this same issue , that's why I took a look into it
@LukasWallrich

@richarddushime richarddushime requested a review from a team as a code owner February 5, 2025 10:02
Copy link

github-actions bot commented Feb 5, 2025

👍 All image files/references (if any) are in webp format, in line with our policy.

Copy link
Contributor

@LukasWallrich LukasWallrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent catch, thanks! I'm never quite sure how to test action changes in staging, but it looks good (and won't break the website), so I am happy to merge it.

@richarddushime
Copy link
Contributor Author

richarddushime commented Feb 5, 2025

Excellent catch, thanks! I'm never quite sure how to test action changes in staging, but it looks good (and won't break the website), so I am happy to merge it.

To test the Github actions locally you can use the act package see more here

Once merged I will push an empty commit to rerun the checks

@richarddushime richarddushime merged commit d5f6b3f into master Feb 9, 2025
5 checks passed
@richarddushime richarddushime deleted the fix-images-checks branch February 9, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants