Skip to content

ci: move to trunk-based development - #2917

Draft
Snailedlt wants to merge 1 commit into
devicons:developfrom
Snailedlt:chore/trunk-based-migration-upstream
Draft

Snailedlt wants to merge 1 commit into
devicons:developfrom
Snailedlt:chore/trunk-based-migration-upstream

Conversation

@Snailedlt

@Snailedlt Snailedlt commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What this does

Moves devicon to trunk-based development:

  • One branch, master. PRs target master and are squash-merged, so the PR title becomes the commit message and the release-notes line. develop and its labeler workflows are removed.
  • Weekly build and release (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 the production environment. The version bump comes from the release: major|minor|patch labels of the PRs merged since the last release. build_icons.yml is removed.
  • Icon PR check (check_icon_pr.yml) finds the icon from the changed files instead of the title. It:
    • fixes a wrong title by renaming the PR;
    • allows only one icon per PR;
    • adds a release: label, major for renames and removals.
  • Actions are on Node 24, pinned to commit SHAs, and kept up to date by Dependabot.
  • npm publishing keeps the trusted publishing (OIDC) setup from develop.

Possibly controversial

  • master can have SVGs that aren't in the font yet, until the next weekly build.
  • The check-bot renames icon PRs and sets release labels by itself. Maintainers can still change both.
  • PRs that change more than one icon fail the check.
  • Peek screenshots are stored in a screenshots branch in this repo instead of on imgur.
  • A bot GitHub App bypasses the master ruleset to push the build: 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:

Not tested yet:

  • npm trusted publishing when build_weekly.yml calls npm_publish.yml. Forks only do a dry run, so this is first tested by the first real release.
  • Peek on the bot:peek label with the new peek script. The fork peeked automatically, but the script is the same.

How to do the migration

Before merging

  1. Freeze merges into develop.
  2. Merge develop into master with a merge commit, not a squash, so the history is kept.
  3. Change this PR's base to master. The diff stays the same, because master now contains develop.
  4. Create the bot app (org admin):
    • Create a GitHub App in the devicons org with Contents: Read and write and Pull requests: Read and write, and install it on this repo.
    • Add vars.BOT_APP_ID and secrets.BOT_APP_PRIVATE_KEY.
  5. Set up environments and labels:
    • Environment production with required reviewers (whoever approves releases). Keep release for npm.
    • Labels release: major, release: minor and release: patch.
  6. npm: set the trusted publisher on npmjs.com to workflow build_weekly.yml, environment release. npm checks the calling workflow; please verify this.

Merge

  1. Squash-merge this PR into master.

After merging

  1. Protect master:
    • Ruleset: require a PR with 1 approval, squash merge only, block force pushes and deletion. Bypass list: the bot app (always).
    • Delete any classic branch protection rule on master, since its own bypass list would block the bot.
    • Settings → General: allow squash merging only, with the PR title as the default commit message.
  2. Retarget the open PRs from develop to master, then delete develop.
  3. Publish the updated wiki pages, which still describe develop. They're ready as a branch.
  4. Announce the change on Discord and in Discussions: target master, fonts are built weekly.
  5. Smoke test: add bot:peek to one icon PR, then run build_weekly.yml by hand and approve production. 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)

Prepared by Claude (an AI assistant) on behalf of @Snailedlt.

🤖 Generated with Claude Code

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>
@Snailedlt
Snailedlt marked this pull request as draft November 25, 2026 18:08

@Yashh56 Yashh56 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

  1. optimize_svgs silently fails on Linux CI (.github/scripts/icomoon_build_githubless.py:103): subprocess.run(["npm", "run", "optimize-svg", ...], shell=True) passes a list with shell=True. On Ubuntu (ubuntu-24.04), POSIX executes /bin/sh -c npm run optimize-svg ..., turning run and the args into $0, $1... for /bin/sh instead of passing them to npm. Without check=True, SVG optimization fails silently on every CI build. Dropping shell=True on POSIX (shell=(os.name == "nt")), passing check=True, and optimizing only changed/new SVGs fixes this.
  2. dot-net (hyphenated names) skip stroke checks (.github/scripts/build_assets/util.py:82): is_svg_in_font_attribute splits 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.svg already exists in the repo and parses to "net-plain", bypassing stroke validation in check_svgs. Stripping icon['name'] + '-' fixes this.
  3. pr_title.yml Node 20 pin & .github/semantic.yml conflict: .github/workflows/pr_title.yml is still pinned to actions/github-script@v8.0.0 (Node 20), unlike the Node 24 pins across the rest of the PR. Also, master still has .github/semantic.yml (Ezard/semantic-prs), which rejects update icon: (e.g., it failed on PR #2908) and lacks build/perf/revert. Worth deleting .github/semantic.yml after merging develop into master.
  4. 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 from npm_publish.yml will break npm_publish.yml's workflow_dispatch and manual release: [released] triggers unless build_weekly.yml is added alongside it (or manual publish runs also go through build_weekly.yml).
  5. First build_weekly.yml run scale & master branch protection: Over v2.18.0..develop, get_icons_for_building queues 79 icons (roughly 140+ SVGs). BuildSeleniumRunner.upload_svgs currently spends up to 5s per clean SVG on back-to-back alert waits (SHORT_WAIT_IN_SEC) and wait_for_zip times out at 25s, so the first run may exceed 15 minutes and time out downloading the zip. Also remember to remove Check the devicon.json and the SVGs' quality from master branch rules if check_icon_pr.yml keeps its paths: filter, otherwise non-icon PRs will hang waiting for a skipped check.

(Prepared by an AI assistant on behalf of @Yashh56.)

types:
- completed

permissions:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 }}';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

  1. 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 in pr_num.txt executes arbitrary JS with write permissions.
  2. echo "err_message<<EOF" >> $GITHUB_OUTPUT (line 46) can also be broken out of if err_messages.txt contains a line equal to EOF.
  3. Unlike post_check_icon_pr_comment.yml's Verify the PR step, there is no check that prNum is a positive integer or that pr.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({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 same branchSha and the second non-force updateRef fails with HTTP 422.
  • When creating screenshots (lines 80-91), branching from heads/master and passing base_tree: commit.tree.sha keeps a full copy of the repo in screenshots. Creating an orphan commit (createTree with no base_tree, createCommit with parents: []) keeps the branch strictly to screenshots.
  • Minor: fs.readdirSync on 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 though icomoon_peek.py now 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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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, COUNT stays 0, needs_glyphs is false, and fonts are never rebuilt. Note that framermotion is already removed in develop's devicon.json while framermotion-original and framermotion-original-wordmark remain in icomoon.json (and fork PR #113 for XML removal is still open).
  • If an icon is renamed (foo -> bar), only bar enters icons_to_build, so find_icomoon_icon_not_in_new_icons never strips foo-* from icomoon.json.
  • verify_glyph_codes (line 88) would actually fail if an orphan were stripped because it errors whenever any glyph in codes_before outside built_names disappears. It also never verifies that rebuilt glyphs (is_built(n)) actually succeeded in appearing in codes_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 }')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

build: SINCE grep collides with contributor build: PRs, and non-font SVG updates create a weekly no-op loop.

  • .github/workflows/pr_title.yml allows build: as a conventional-commit PR type (build: update gulp, etc.). Because PRs squash-merge onto master, any build: PR merged after a weekly build becomes $SINCE, causing the next build_weekly run to permanently skip glyph builds for earlier icon PRs.
  • Also, if a PR only updates a non-font SVG (original not in versions.font), has_changes is true, needs_glyphs is false, CSS doesn't change, and no commit is created. $SINCE stays pinned before that PR and repeats npm install + build-css every 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

git pull --rebase origin master here can permanently skip concurrent icon updates (plus unreachable geckodriver.log upload above).

  1. If an icon PR merges onto master while IcoMoon is running, rebasing build: generate font files and CSS onto that PR moves the $SINCE boundary 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 in icomoon.json, they will never be rebuilt. Either failing/re-running on master drift or recording the pre-build SHA avoids silent drops.
  2. At line 184 (Upload geckodriver log on failure), if: failure() runs before Handle build failure fails the job, and build / build-css both use continue-on-error: true, so failure() is always false there and geckodriver.log is 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

release checks out moving master after production approval, and npm install on line 419 risks failing npm version.

  • release pauses at environment: production for manual approval, then checks out ref: master. Any icon PR merged while waiting for approval is pulled into npm version, release notes, the git tag, and the npm package before its font glyphs or devicon.min.css are built. Meanwhile, workflow-level concurrency (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 if master moved) prevents shipping half-built icons, and splitting/job-scoping concurrency keeps weekly builds unblocked.
  • Line 419 (npm install in release): npm version and node -p need zero installed packages, and running npm install (Node 24 / npm 11) against a lockfileVersion: 2 package-lock.json risks dirtying the tree so npm version fails with Git 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 on develop (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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

get_svg_versions runs before check_devicon_object, plus a couple of diff/title edge cases.

  • util.get_svg_versions accesses icon["versions"]["svg"] here before check_devicon_object(icon) validates devicon.json at line 92, so a malformed entry throws an unhandled KeyError/TypeError before emitting errors or release_label.txt. Similarly, icon["name"] isn't validated against ^[a-z0-9._-]+$ even though post_check_icon_pr_comment.yml line 88 rejects titles with uppercase names, and line 114 of check_devicon_object still checks len(versions["svg"]) == 0 instead of versions["font"].
  • In util.py:48, non-.svg files added inside icons/<name>/ (e.g. .png, .md, .SVG) don't end with .svg and aren't added to other_files, so stray files pass silently.
  • When both the PR title and SVGs have issues, setting expected_title alongside err_messages.txt causes post_check_icon_pr_comment.yml to comment the errors, rename the PR (re-triggering edited), and comment the exact same errors a second time.

@Yashh56 Yashh56 added enhancement devops Devops, devex and automation related enhancements labels Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops Devops, devex and automation related enhancements enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants