Skip to content

build: add min release age step - #8164

Draft
tomdavies73 wants to merge 2 commits into
masterfrom
add_min_release_age_build_step
Draft

build: add min release age step#8164
tomdavies73 wants to merge 2 commits into
masterfrom
add_min_release_age_build_step

Conversation

@tomdavies73

@tomdavies73 tomdavies73 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Proposed behaviour

Adds a build step which will alert us if any packages do not meet our minimum release age. This is particularly useful for dependabot raised PRs as there is currently no way to get dependabot to respect our minumum release age.

This prevents us from accidentially adding recently published packages which are comporomised via dependabot.

Here's a link to a run that shows the new check succesully failing on a recently published package

Here's a link to a run that shows the new check sucessfully failing after the above package met maturity guidelines

Current behaviour

Currently dependabot does not adhere to our minimum release age during security alerts, therefore if we do not verify the package maturity we could accept package updates which are not aligned with our maturity guidelines.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

@tomdavies73 tomdavies73 self-assigned this Sep 3, 2026
@tomdavies73 tomdavies73 added the Work in progress This is a WIP PR so may not be ready for review label Sep 3, 2026
@tomdavies73
tomdavies73 requested a balanced review from Copilot September 3, 2026 08:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The threshold unit is incorrect, and dependency code can execute in parallel jobs before validation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds CI enforcement for minimum npm package release age.

Changes:

  • Adds concurrent registry checks for locked package versions.
  • Exposes the checker through npm.
  • Runs the check before the build job installs dependencies.
File summaries
File Description
scripts/check-release-age.mjs Implements release-age validation.
package.json Adds the validation command.
.github/workflows/ci.yml Integrates validation into CI.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/ci.yml
Comment on lines +152 to +155
- name: Check release age
run: npm run check-release-age
env:
MIN_RELEASE_AGE: ${{ steps.age.outputs.min-release-age }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure there is a real risk here, our checks are ran in an isolated enviroment so its not the end of the world if we do an npm install elsewhere here.

I think all that really matters is that we throw an exit code 1 and the build fails so we can't merge the PR 👍

});

const now = Date.now();
const minimumAgeInMilliseconds = minReleaseAge * MILLISECONDS_IN_DAY;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

min-release-age=3 will be counted as 3 days, not sure where its getting 3 seconds from. What we have here works as expected

Comment thread scripts/check-release-age.mjs Outdated
Comment on lines +86 to +88
const response = await fetch(getPackageUrl(registry, packageName), {
headers: { Accept: "application/json" },
});
@tomdavies73
tomdavies73 force-pushed the add_min_release_age_build_step branch from 4549819 to 86e36aa Compare September 8, 2026 13:18
@tomdavies73 tomdavies73 added Pending Review No QA Required No UX QA Required and removed Work in progress This is a WIP PR so may not be ready for review labels Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants