Skip to content

Add debian-package icon for *.deb packages #648

Add debian-package icon for *.deb packages

Add debian-package icon for *.deb packages #648

Workflow file for this run

name: Icon Review
on:
pull_request_target:
paths:
- 'icons/*.svg'
permissions:
contents: read
jobs:
icon-review:
name: Icon Review
runs-on: ubuntu-latest
env:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
permissions:
pull-requests: write
steps:
- name: Setup Platform 🛠️
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
with:
bun-version: 1.1.20
- name: Checkout Fork 🛎️
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
path: fork
persist-credentials: false
- name: Checkout Original 🛎️
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0
path: main
persist-credentials: false
- name: Review SVG files 🔍
working-directory: main
run: |
files=$(git diff --no-index ../main ../fork --diff-filter=ACMRTUX --name-only | grep '^\.\./fork/icons/.*\.svg$')
filesCount=$(echo "$files" | wc -l)
bunx --bun svg-icon-review@2.1.0 --bigIcon ${files}
echo svg_files_count=$filesCount >> $GITHUB_ENV
- name: Upload PNG ⬆️
env:
IMAGE_UPLOAD: ${{ secrets.IMAGE_UPLOAD }}
id: upload
run: |
IMAGE_URL=$(curl --location 'https://freeimage.host/json' --form 'source=@"./main/preview.png"' --form 'type="file"' --form 'action="upload"' --form 'auth_token="${{env.IMAGE_UPLOAD}}"' | jq -r '.image.url')
echo image_url=$IMAGE_URL >> $GITHUB_ENV
- name: Generate text 📃
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const iconsCount = parseInt("${{ env.svg_files_count }}");
const imageURL = "${{ env.image_url }}";
const image = `<img src="${imageURL}" alt="Generated preview" />`;
const pluralS = iconsCount > 1 ? "s" : "";
let preview = "";
if (iconsCount > 10) {
preview = `<details><summary>🏞️ <b>Generated preview</b></summary><br/>${image}</details>`;
} else {
preview = image;
}
const comment = `
<!-- Preview generated by GitHub Actions -->
## Preview
Thank you for creating a pull request. This preview shows you how your icon${pluralS} will look on the different themes:
${preview}
Check how your icon${pluralS} fit${!pluralS ? 's' : ''} in a 16x16 grid with our **Pixel Perfect Checker** by following [this link](https://pixp.lucode.ar/material-extensions/vscode-material-icon-theme/pull/${{ github.event.pull_request.number }}).
You can find more information on how to contribute in the [contribution guidelines](https://github.com/material-extensions/vscode-material-icon-theme/blob/main/CONTRIBUTING.md).
`;
// Write comment to environment variable
core.exportVariable('comment', comment);
- name: Find comment if exists 🕵️
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: <!-- Preview generated by GitHub Actions -->
- name: Post or update comment in PR ✍️
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ env.comment }}
edit-mode: replace