Repository navigation
Conversation
Single master branch: PRs target master and are squash-merged. Fonts and CSS are built weekly by build_weekly.yml, which then releases (gated by the production environment) with the bump taken from release: labels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Yashh56
left a comment
There was a problem hiding this comment.
Great direction overall: single-branch master, squash merges, weekly build_weekly.yml gated by production, screenshots-branch Peek hosting, and diff-based PR checks make the workflow much cleaner.
I ran a full pass across the diff, untouched interacting files, and a simulation over v2.18.0..develop. Leaving inline notes on the main workflow/script hunks, plus a few cross-file and rollout findings below.
Cross-file & untouched issues
optimize_svgssilently fails on Linux CI (.github/scripts/icomoon_build_githubless.py:103):subprocess.run(["npm", "run", "optimize-svg", ...], shell=True)passes a list withshell=True. On Ubuntu (ubuntu-24.04), POSIX executes/bin/sh -c npm run optimize-svg ..., turningrunand the args into$0, $1...for/bin/shinstead of passing them tonpm. Withoutcheck=True, SVG optimization fails silently on every CI build. Droppingshell=Trueon POSIX (shell=(os.name == "nt")), passingcheck=True, and optimizing only changed/new SVGs fixes this.dot-net(hyphenated names) skip stroke checks (.github/scripts/build_assets/util.py:82):is_svg_in_font_attributesplits on the first hyphen (stem.split('-', 1)[1]). While the rest of the PR adds support for[a-z0-9._-]+in icon names,dot-net-plain.svgalready exists in the repo and parses to"net-plain", bypassing stroke validation incheck_svgs. Strippingicon['name'] + '-'fixes this.pr_title.ymlNode 20 pin &.github/semantic.ymlconflict:.github/workflows/pr_title.ymlis still pinned toactions/github-script@v8.0.0(Node 20), unlike the Node 24 pins across the rest of the PR. Also,masterstill has.github/semantic.yml(Ezard/semantic-prs), which rejectsupdate icon:(e.g., it failed on PR #2908) and lacksbuild/perf/revert. Worth deleting.github/semantic.ymlafter mergingdevelopintomaster.- npm OIDC fallback caveat: Step 4 updates npmjs.com's trusted publisher to
build_weekly.yml. Since npm checks the caller workflow filename, switching away fromnpm_publish.ymlwill breaknpm_publish.yml'sworkflow_dispatchand manualrelease: [released]triggers unlessbuild_weekly.ymlis added alongside it (or manual publish runs also go throughbuild_weekly.yml). - First
build_weekly.ymlrun scale &masterbranch protection: Overv2.18.0..develop,get_icons_for_buildingqueues 79 icons (roughly 140+ SVGs).BuildSeleniumRunner.upload_svgscurrently spends up to 5s per clean SVG on back-to-back alert waits (SHORT_WAIT_IN_SEC) andwait_for_ziptimes out at 25s, so the first run may exceed 15 minutes and time out downloading the zip. Also remember to removeCheck the devicon.json and the SVGs' qualityfrommasterbranch rules ifcheck_icon_pr.ymlkeeps itspaths:filter, otherwise non-icon PRs will hang waiting for a skipped check.
(Prepared by an AI assistant on behalf of @Yashh56.)
| types: | ||
| - completed | ||
|
|
||
| permissions: |
There was a problem hiding this comment.
Missing actions: read permission (artifact download will fail with 403).
Declaring top-level permissions: with contents, issues, and pull-requests revokes all unlisted permissions, leaving actions: none. dawidd6/action-download-artifact@v27 requires actions: read (compare post_check_icon_pr_comment.yml line 9, which includes it). Also, workflow_run.conclusion != 'skipped' triggers this job on cancelled/timed_out runs that never uploaded pr_num.txt; gating on conclusion == 'success' || conclusion == 'failure' matches post_check_icon_pr_comment.yml.
| script: | | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
| const prNum = '${{ steps.pr_num_reader.outputs.pr_num }}'; |
There was a problem hiding this comment.
Security: untrusted workflow_run artifact injection and missing head_sha check.
peek_icons.yml checks out and runs code from fork PRs when bot:peek is applied, and this workflow holds contents: write, issues: write, and pull-requests: write.
PR_NUM=$(cat ./pr_num/pr_num.txt | tr -d '[:space:]')only strips whitespace, and${{ steps.pr_num_reader.outputs.pr_num }}is interpolated directly into JS source here (as well as lines 146, 204, and 260). A whitespace-free payload inpr_num.txtexecutes arbitrary JS with write permissions.echo "err_message<<EOF" >> $GITHUB_OUTPUT(line 46) can also be broken out of iferr_messages.txtcontains a line equal toEOF.- Unlike
post_check_icon_pr_comment.yml'sVerify the PRstep, there is no check thatprNumis a positive integer or thatpr.head.sha === context.payload.workflow_run.head_sha.
Mirroring post_check_icon_pr_comment.yml (reading files directly inside github-script with fs.readFileSync, checking pr.head.sha, and removing ${{ }} JS interpolation) resolves all three.
|
|
||
| Here are the icons that will be generated by Icomoon: | ||
| {2} | ||
| await github.rest.git.updateRef({ |
There was a problem hiding this comment.
Concurrent bot:peek runs race on heads/screenshots, plus initial branch creation copies master.
- This workflow has no
concurrency:group, so two peek runs finishing close together read the samebranchShaand the second non-forceupdateReffails with HTTP 422. - When creating
screenshots(lines 80-91), branching fromheads/masterand passingbase_tree: commit.tree.shakeeps a full copy of the repo inscreenshots. Creating an orphan commit (createTreewith nobase_tree,createCommitwithparents: []) keeps the branch strictly to screenshots. - Minor:
fs.readdirSyncon Linux isn't guaranteed sorted,const img(line 156) is unused, and the Peek failure template still tells contributors to check their PR title even thoughicomoon_peek.pynow reads changed files instead of titles.
| for icon in devicon_json: | ||
| aliases = {alias["alias"] for alias in icon["aliases"]} | ||
| expected = {v for v in icon["versions"]["font"] if v not in aliases} | ||
| if not expected: |
There was a problem hiding this comment.
Deleted, renamed, and font-emptied icons are never removed from icomoon.json or fonts/.
get_icons_for_building iterates only devicon_json and skips entries with empty non-alias font versions here (if not expected: continue).
- If a PR removes an icon or clears its
versions.font,COUNTstays0,needs_glyphsisfalse, and fonts are never rebuilt. Note thatframermotionis already removed indevelop'sdevicon.jsonwhileframermotion-originalandframermotion-original-wordmarkremain inicomoon.json(and fork PR#113for XML removal is still open). - If an icon is renamed (
foo -> bar), onlybarentersicons_to_build, sofind_icomoon_icon_not_in_new_iconsnever stripsfoo-*fromicomoon.json. verify_glyph_codes(line 88) would actually fail if an orphan were stripped because it errors whenever any glyph incodes_beforeoutsidebuilt_namesdisappears. It also never verifies that rebuilt glyphs (is_built(n)) actually succeeded in appearing incodes_after.
Suggest detecting glyphs in icomoon.json absent from active non-alias devicon.json entries, stripping them alongside icons_to_build, allowing BuildSeleniumRunner.build_icons to regenerate without uploading when svgs is empty, excluding intentional removals from verify_glyph_codes, and asserting expected rebuilt glyphs exist in codes_after.
| id: check-changes | ||
| run: | | ||
| # Find the last commit whose message starts with "build:" | ||
| SINCE=$(git log --format="%H %s" | awk '/^[a-f0-9]+ build:/ { print $1; exit }') |
There was a problem hiding this comment.
build: SINCE grep collides with contributor build: PRs, and non-font SVG updates create a weekly no-op loop.
.github/workflows/pr_title.ymlallowsbuild:as a conventional-commit PR type (build: update gulp, etc.). Because PRs squash-merge ontomaster, anybuild:PR merged after a weekly build becomes$SINCE, causing the nextbuild_weeklyrun to permanently skip glyph builds for earlier icon PRs.- Also, if a PR only updates a non-font SVG (
originalnot inversions.font),has_changesistrue,needs_glyphsisfalse, CSS doesn't change, and no commit is created.$SINCEstays pinned before that PR and repeatsnpm install+build-cssevery Monday.
Matching the exact bot subject (build: generate font files and CSS) avoids PR title collisions, and only flagging has_changes on non-font SVGs when SVG optimization is needed (or checking devicon.json / needs_glyphs for CSS) avoids the no-op loop.
| if ! git diff --staged --quiet; then | ||
| git commit -m "build: generate font files and CSS" | ||
| # master may have moved while the build ran | ||
| git pull --rebase origin master |
There was a problem hiding this comment.
git pull --rebase origin master here can permanently skip concurrent icon updates (plus unreachable geckodriver.log upload above).
- If an icon PR merges onto
masterwhile IcoMoon is running, rebasingbuild: generate font files and CSSonto that PR moves the$SINCEboundary ahead of the new PR. Next week's run will not see that PR's SVG updates in$SINCE..HEAD, and since the glyph names already exist inicomoon.json, they will never be rebuilt. Either failing/re-running onmasterdrift or recording the pre-build SHA avoids silent drops. - At line 184 (
Upload geckodriver log on failure),if: failure()runs beforeHandle build failurefails the job, andbuild/build-cssboth usecontinue-on-error: true, sofailure()is alwaysfalsethere andgeckodriver.logis never uploaded.
| with: | ||
| # Explicit ref so we get the build: commit pushed by the build job, | ||
| # not the commit the workflow was triggered on | ||
| ref: master |
There was a problem hiding this comment.
release checks out moving master after production approval, and npm install on line 419 risks failing npm version.
releasepauses atenvironment: productionfor manual approval, then checks outref: master. Any icon PR merged while waiting for approval is pulled intonpm version, release notes, the git tag, and the npm package before its font glyphs ordevicon.min.cssare built. Meanwhile, workflow-levelconcurrency(build-and-release) stalls next Monday's scheduled build behind an unapproved release gate.- Checking out the exact commit SHA produced by
build(or blocking ifmastermoved) prevents shipping half-built icons, and splitting/job-scoping concurrency keeps weekly builds unblocked. - Line 419 (
npm installinrelease):npm versionandnode -pneed zero installed packages, and runningnpm install(Node 24 / npm 11) against alockfileVersion: 2package-lock.jsonrisks dirtying the tree sonpm versionfails withGit working directory not clean. - Line 276 (
(#(\d+))): unanchored regex pulls in issue/PR numbers mentioned mid-title (e.g. reverts) and skips merge commits already ondevelop(like PR#2857). Anchoring to end-of-line/\(#(\d+)\)$/(plus^Merge pull request #(\d+)for the first release) prevents mismatches.
|
|
||
| - name: Check if PR is develop | ||
| if: ${{ github.base_ref != 'develop' }} | ||
| - name: Check if PR targets master |
There was a problem hiding this comment.
Wrong-base exit happens before uploading pr_num, suppressing bot feedback on post_check_icon_pr_comment.yml.
Check if PR targets master exits 1 before Save the pr num in an artifact and Upload the pr num (lines 36-46). Contributors who still open PRs against develop after migration will trigger post_check_icon_pr_comment.yml on failure, fail on missing pr_num.txt, and get no comment explaining to target master. Moving pr_num capture/upload above this step (or writing the error to err_messages.txt as before) keeps the UX working.
| err_msg.append(f"`icons/{name}/` was changed, but `devicon.json` has no entry named \"{name}\".") | ||
| elif name in changes["svgs"]: | ||
| icon = icons_by_name[name] | ||
| versions, invalid_files = util.get_svg_versions(icon, changes["svgs"][name]) |
There was a problem hiding this comment.
get_svg_versions runs before check_devicon_object, plus a couple of diff/title edge cases.
util.get_svg_versionsaccessesicon["versions"]["svg"]here beforecheck_devicon_object(icon)validatesdevicon.jsonat line 92, so a malformed entry throws an unhandledKeyError/TypeErrorbefore emitting errors orrelease_label.txt. Similarly,icon["name"]isn't validated against^[a-z0-9._-]+$even thoughpost_check_icon_pr_comment.ymlline 88 rejects titles with uppercase names, and line 114 ofcheck_devicon_objectstill checkslen(versions["svg"]) == 0instead ofversions["font"].- In
util.py:48, non-.svgfiles added insideicons/<name>/(e.g..png,.md,.SVG) don't end with.svgand aren't added toother_files, so stray files pass silently. - When both the PR title and SVGs have issues, setting
expected_titlealongsideerr_messages.txtcausespost_check_icon_pr_comment.ymlto comment the errors, rename the PR (re-triggeringedited), and comment the exact same errors a second time.
What this does
Moves devicon to trunk-based development:
master. PRs targetmasterand are squash-merged, so the PR title becomes the commit message and the release-notes line.developand its labeler workflows are removed.build_weekly.yml, Mondays 2 AM UTC, or run by hand). It builds the font and CSS if icons changed, then makes a release once a maintainer approves theproductionenvironment. The version bump comes from therelease: major|minor|patchlabels of the PRs merged since the last release.build_icons.ymlis removed.check_icon_pr.yml) finds the icon from the changed files instead of the title. It:release:label,majorfor renames and removals.develop.Possibly controversial
mastercan have SVGs that aren't in the font yet, until the next weekly build.screenshotsbranch in this repo instead of on imgur.masterruleset to push thebuild:and version commits and tags.Peek still runs when a maintainer adds
bot:peek. Running it automatically will be a separate PR.Tested
On the fork, by @Yashh56 and me:
devicon.jsononly, removal.Not tested yet:
build_weekly.ymlcallsnpm_publish.yml. Forks only do a dry run, so this is first tested by the first real release.bot:peeklabel with the new peek script. The fork peeked automatically, but the script is the same.How to do the migration
Before merging
develop.developintomasterwith a merge commit, not a squash, so the history is kept.master. The diff stays the same, becausemasternow containsdevelop.Contents: Read and writeandPull requests: Read and write, and install it on this repo.vars.BOT_APP_IDandsecrets.BOT_APP_PRIVATE_KEY.productionwith required reviewers (whoever approves releases). Keepreleasefor npm.release: major,release: minorandrelease: patch.build_weekly.yml, environmentrelease. npm checks the calling workflow; please verify this.Merge
master.After merging
master:master, since its own bypass list would block the bot.developtomaster, then deletedevelop.develop. They're ready as a branch.master, fonts are built weekly.bot:peekto one icon PR, then runbuild_weekly.ymlby hand and approveproduction. This first real release is also the npm trusted-publishing test. Its release notes will list every PR since the last release.Suggested next steps (separate PRs)
bot:peek.icons/<name>/<name>.jsoninstead of editing the shareddevicon.json. This ends merge conflicts between icon PRs;devicon.jsonis generated by the build.Prepared by Claude (an AI assistant) on behalf of @Snailedlt.
🤖 Generated with Claude Code