Skip to content

Add @girs dependency auto-update workflow#135

Merged
JumpLink merged 3 commits into
mainfrom
ci/auto-update-girs
Jul 3, 2026
Merged

Add @girs dependency auto-update workflow#135
JumpLink merged 3 commits into
mainfrom
ci/auto-update-girs

Conversation

@JumpLink

@JumpLink JumpLink commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Automates keeping the @girs/* type dependencies current, so we don't have to bump them by hand after every ts-for-gir release.

How it works

  • Weekly schedule (Mon 06:00 UTC) + workflow_dispatch + a girs-release repository_dispatch for an instant trigger from ts-for-gir's release workflow.
  • scripts/update-girs.mjs bumps every @girs/* dep to ^<latest> (caret on the npm latest dist-tag). The workflow then installs, runs the full validation (build:types, prettier:check, validate:types, build:example, validate:example) and opens/updates a PR — as a draft if validation fails, so type-affecting upgrades are flagged rather than merged blindly.

Why caret ranges

Since gjsify/ts-for-gir#432 (released as 4.1) @girs/* versions as the ts-for-gir release alone (release-only scheme). On that scheme a caret range dedupes across stable releases and excludes prereleases (4.2.0-rc.1 does not satisfy ^4.1.0) — on Yarn 4 too.

Exact top-level pins are deliberately avoided: they re-diverge from the transitive ^x deps of the @girs packages as soon as a newer @girs patch ships, which re-opens the duplicate-copy issue (ts-for-gir#431). The updater therefore advances the caret floor to the latest release — this refreshes the declared minimum and gives the workflow a concrete diff to validate the new types against.

Verified locally: emits ^4.1.0, is idempotent (no-op on a second run, so no PR churn), and leaves workspace: specifiers untouched.

The namespace fix (@girs/cogl-2.0@girs/cogl-18, #126 / #132) stays manual — the script only bumps versions of existing keys, it doesn't add/remove/rename packages. The first scheduled run will bump the deps off the release candidates, addressing #125.

Keep the @girs/* type dependencies on the latest stable release
without manual bumps.

- scripts/update-girs.mjs pins every @Girs dependency to its npm
  "latest" dist-tag as an exact version. Exact pins are required:
  the @Girs scheme encodes the library and ts-for-gir version in one
  semver string, so a stable suffix sorts below a release candidate
  and ranges resolve back to the rc (see #125). The script leaves
  protocol specifiers like "workspace:" untouched and does not
  rename packages.
- "yarn update:girs" runs it for the package and the example.
- .github/workflows/update-girs.yml runs daily (plus manual dispatch
  and a repository_dispatch "girs-release" hook), bumps, installs,
  validates, and opens/updates a single chore/update-girs PR only
  when something changed — as a draft with a warning if validation
  fails.
schnz
schnz previously approved these changes Jul 1, 2026

@schnz schnz 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.

Nice flow! LGTM

Personally, I would adapt the schedule to run once a week (instead of daily). But thats just personal preference, resulting from experience with renovate which tends to open new PRs on a daily basis if it isn't restricted in that kind of way (and this also helps mitigating the supply-chain attacks [up to a point] that became so popular recently). Probably non of that is relevant for this workflow.

Comment thread .github/workflows/update-girs.yml Outdated
JumpLink added a commit that referenced this pull request Jul 3, 2026
@girs/cogl-2.0 pulled a second, incompatible copy of the Cogl types
into the tree, so a method using both Cairo and Cogl types could not
type-check. @girs/cogl-18 is the version @girs/clutter-18 and
@girs/meta-18 depend on; switching to it dedupes Cogl and lets Cairo
+ Cogl be used together.

Leaves the @Girs versioning scheme untouched (still on the current rc
ranges) so the auto-update workflow in #135 can take over the bumps.

Closes #126
Address review on #135:
- Schedule weekly (Mon 06:00 UTC) instead of daily, per @schnz — avoids
  renovate-style daily PR churn and slightly reduces supply-chain
  exposure window.
- Drop NODE_OPTIONS=--max_old_space_size=9216 from the validate steps;
  build:types + validate:types/example pass under Node 22's default
  heap (verified locally), so the 9 GiB override isn't needed.
@JumpLink

JumpLink commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the review @schnz! Addressed both points in d84cb25

ts-for-gir#432 (released as 4.1) drops the coupled <lib>-<app> version
scheme: @Girs packages now version as the ts-for-gir release alone, so a
caret range dedupes across stable releases and excludes prereleases
(on Yarn 4 too). Switch the updater from exact pins to `^<latest>` and
rewrite the now-obsolete rationale (script header + PR-body text).

Exact top-level pins are avoided on purpose: they re-diverge from the
transitive `^x` deps as soon as a newer @Girs patch ships, re-opening
the duplicate-copy issue (ts-for-gir#431).

Verified locally: emits `^4.1.0`, is idempotent (no-op second run, so no
PR churn), and leaves `workspace:` specifiers untouched.
@JumpLink

JumpLink commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

One more change beyond the review points, worth flagging since your approval predates it: I switched the updater from exact pins to caret ranges (^<latest>).

Rationale: ts-for-gir#432 (released as 4.1) dropped the coupled <lib>-<app> version scheme, so @girs now versions as the ts-for-gir release alone. On that scheme a caret dedupes across stable releases and excludes prereleases (Yarn 4 included) — and exact top-level pins would actually re-open the duplicate-@girs/gobject copy issue (ts-for-gir#431) the moment a newer patch ships, because they'd diverge from the transitive ^x deps the @girs packages now use internally. The script header explains it in full.

Verified locally: emits ^4.1.0, idempotent (no PR churn), workspace: untouched. Happy to walk through it if you want another look.

@schnz

schnz commented Jul 3, 2026

Copy link
Copy Markdown
Member

One more change beyond the review points, worth flagging since your approval predates it: I switched the updater from exact pins to caret ranges (^).

Yes, I saw that change. Nice to have semver-compatible versions now :)

@JumpLink
JumpLink merged commit debe451 into main Jul 3, 2026
1 check passed
@JumpLink
JumpLink deleted the ci/auto-update-girs branch July 3, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants