Merge branch 'main' of https://github.com/tabler/tabler-icons into add-icon/filled/crown

This commit is contained in:
codecalm 2025-12-23 02:31:07 +01:00
commit 7840a48b2a
3 changed files with 24 additions and 4 deletions

View File

@ -2,10 +2,12 @@ import { execSync } from 'child_process'
import { basename, join } from 'path'
import { ICONS_SRC_DIR, parseMatter } from './helpers.mjs'
// Check icon files added relative to main branch (for PR)
// Check icon files added relative to base branch (for PR)
function getAddedIconsFromMain() {
try {
const output = execSync('git diff origin/main...HEAD --name-status', { encoding: 'utf-8' })
// Use BASE_SHA or BASE_REF from environment, fallback to origin/main
const baseRef = process.env.BASE_SHA || process.env.BASE_REF || 'origin/main'
const output = execSync(`git diff ${baseRef}...HEAD --name-status`, { encoding: 'utf-8' })
const addedIcons = []
output.split('\n').forEach(line => {
@ -21,7 +23,7 @@ function getAddedIconsFromMain() {
return addedIcons
} catch (error) {
// Fallback: check relative to HEAD if origin/main doesn't exist
// Fallback: check relative to HEAD if base ref doesn't exist
try {
const output = execSync('git diff --diff-filter=A --name-only', { encoding: 'utf-8' })
const addedIcons = []

View File

@ -25,7 +25,9 @@ const getIconName = (icon) => {
function getAddedIconsFromMain() {
try {
const output = execSync('git diff origin/main...HEAD --name-status', { encoding: 'utf-8' })
// Use BASE_SHA or BASE_REF from environment, fallback to origin/main
const baseRef = process.env.BASE_SHA || process.env.BASE_REF || 'origin/main'
const output = execSync(`git diff ${baseRef}...HEAD --name-status`, { encoding: 'utf-8' })
const addedIcons = []
output.split('\n').forEach(line => {

View File

@ -16,6 +16,16 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set base branch
run: |
BASE_REF="${{ github.event.pull_request.base.ref }}"
BASE_SHA="${{ github.event.pull_request.base.sha }}"
echo "BASE_REF=${BASE_REF}" >> $GITHUB_ENV
echo "BASE_SHA=${BASE_SHA}" >> $GITHUB_ENV
# Fetch base branch to ensure it's available
git fetch origin ${BASE_REF}:${BASE_REF} || true
- name: Add in progress comment
id: add-in-progress-comment
@ -56,6 +66,9 @@ jobs:
- name: Validate icons
id: validate
env:
BASE_REF: ${{ env.BASE_REF }}
BASE_SHA: ${{ env.BASE_SHA }}
run: pnpm run --silent validate > ./comment-markup.md
continue-on-error: true
@ -68,6 +81,9 @@ jobs:
- name: Generate icons comment
id: generate-icons-comment
env:
BASE_REF: ${{ env.BASE_REF }}
BASE_SHA: ${{ env.BASE_SHA }}
run: pnpm run --silent generate-icons-comment > ./comment-icons.md || true
continue-on-error: true