Skip to content

feat: add .forge folder icon for ForgeKit projects #1676

feat: add .forge folder icon for ForgeKit projects

feat: add .forge folder icon for ForgeKit projects #1676

Workflow file for this run

name: 🏞️ Icon Review
on:
pull_request_target:
paths:
- "icons/*.svg"
permissions:
contents: read
pull-requests: write
jobs:
icon-review:
name: Icon Review
runs-on: ubuntu-latest
env:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
steps:
- name: πŸ“₯ Checkout Fork
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
path: fork
sparse-checkout-cone-mode: false
sparse-checkout: |
icons/
- name: πŸ“₯ Checkout Original
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
path: main
sparse-checkout-cone-mode: false
sparse-checkout: |
icons/
- name: πŸ”§ Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24'
- 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)
npx svg-icon-review@3.0.1 --noSandbox --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@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const iconsCount = parseInt(process.env.svg_files_count);
const imageURL = process.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.pages.dev/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@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
id: find-comment
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@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ env.comment }}
edit-mode: replace