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

Add a GH workflow to check for non-svg icons in the showcase. #3802

Closed
wants to merge 1 commit into from

Conversation

lmuntaner
Copy link
Contributor

Motivation

Keeping the icons for the showcase small.

Changes

Add a github workflow that checks that the icons in the showcase directory are SVGs.

Tests

I'll test this after it's deployed with a new PR adding an icon that is not SVG, they I'll change it to a PR.

If the workflow works as expected, I will add it as a necessary check before merging the PR.

Contribution Info

Thank you for your contribution to the IC Developer Portal. This repo contains the content for https://internetcomputer.org and the ICP Developer Documentation, https://internetcomputer.org/docs/.

If you are submitting a Pull Request for adding or changing content on the ICP Developer Documentation, please make sure that your contribution meets the following requirements:

@lmuntaner lmuntaner requested a review from a team as a code owner November 22, 2024 07:44
@lmuntaner lmuntaner marked this pull request as draft November 22, 2024 09:01
- name: Check for non-SVG files
run: |
# Find new or modified files in the "images" directory
files=$(git diff --name-only ${{ github.event.before }} HEAD -- statuc/img/showcase/)
Copy link
Contributor

Choose a reason for hiding this comment

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

The showcase allows projects to add screenshots and videos in this directory. If you want to check for logos only, you should filter for filenames ending with _logo IMHO.

for file in $files; do
if [[ "$file" != *.svg ]]; then
echo "❌ Non-SVG file detected: $file"
exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

There is an extra check at build time to validate the showcase file, although I suspect the rules there are too relaxed to be useful for you: https://github.com/dfinity/portal/blob/master/plugins/validate-showcase.js#L200

The purpose is to fail PR build checks if the submission isn't following the guidelines, and then hopefully it doesn't get merged. This can be made more strict, but then the current logos in the repo need to be resized/converted to pass validation @reigj1

Nevertheless maybe this can be tweaked to be more helpful.

# Loop through the files and check extensions
for file in $files; do
if [[ "$file" != *.svg ]]; then
echo "❌ Non-SVG file detected: $file"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also update the relevant part of the README.md file if logos must be SVG's from now on.

@lmuntaner
Copy link
Contributor Author

Closing this PR. We decided to take another approach instead of allowing only SVGs.

@lmuntaner lmuntaner closed this Nov 22, 2024
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