Skip to content

Commit c7be6f1

Browse files
jamietannaClaude Sonnet 5
andauthored
ci: periodically check for "too many releases" (#44734)
* ci: periodically check for "too many releases" As a way to get a view of upcoming issues we may see with "too many releases" (i.e. #42965), we can add a CI check that will run daily and give us a warning of starting to get a bit too close to the window for comfort. Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io> * fixup! ci: periodically check for "too many releases" Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io> --------- Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
1 parent f3e5741 commit c7be6f1

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# See https://github.com/renovatebot/renovate/discussions/42965 and related issues in the past
2+
name: 'Check npm packument size'
3+
4+
on:
5+
# run daily
6+
schedule:
7+
- cron: '0 6 * * *'
8+
9+
# allow manual trigger
10+
workflow_dispatch: {}
11+
12+
permissions: {}
13+
14+
jobs:
15+
check-npm-packument-size:
16+
runs-on: ubuntu-latest
17+
if: github.repository == 'renovatebot/renovate'
18+
19+
steps:
20+
- name: Check npm packument size
21+
id: check
22+
env:
23+
PACKAGE_NAME: renovate
24+
# npm rejects publishes once the packument exceeds 100 MB
25+
WARNING_THRESHOLD_MB: 85
26+
CRITICAL_THRESHOLD_MB: 90
27+
run: |
28+
set -euo pipefail
29+
30+
packument_file="$(mktemp)"
31+
curl -fsS -o "$packument_file" "https://registry.npmjs.org/$PACKAGE_NAME"
32+
33+
size_bytes="$(wc -c < "$packument_file")"
34+
size_mb="$(awk -v bytes="$size_bytes" 'BEGIN { printf "%.2f", bytes / 1024 / 1024 }')"
35+
version_count="$(jq '.versions | length' "$packument_file")"
36+
rm -f "$packument_file"
37+
38+
status="$(awk -v size="$size_mb" -v warn="$WARNING_THRESHOLD_MB" -v crit="$CRITICAL_THRESHOLD_MB" \
39+
'BEGIN { if (size >= crit) print "critical"; else if (size >= warn) print "warning"; else print "ok" }')"
40+
41+
echo "::notice title=npm packument size::npm packument size for '$PACKAGE_NAME': ${size_mb} MB across ${version_count} versions (status: $status)"
42+
43+
{
44+
echo "size-mb=$size_mb"
45+
echo "version-count=$version_count"
46+
echo "status=$status"
47+
} >> "$GITHUB_OUTPUT"
48+
49+
{
50+
echo "### npm packument size"
51+
echo "\`$PACKAGE_NAME\` packument is **${size_mb} MB** across **${version_count} versions** (status: \`$status\`, warning: ${WARNING_THRESHOLD_MB} MB, critical: ${CRITICAL_THRESHOLD_MB} MB, npm hard limit: 100 MB)."
52+
} >> "$GITHUB_STEP_SUMMARY"
53+
54+
- name: Post warning to Slack
55+
if: steps.check.outputs.status == 'warning'
56+
uses: slackapi/slack-github-action@0d95c9a7becc1e6e297d76df9bc735c44f4cbcbc # v3.0.5
57+
with:
58+
webhook: ${{ secrets.RENOVATEBOT_SLACK_WEBHOOK_MAIN_FAILURES }}
59+
webhook-type: incoming-webhook
60+
payload: |
61+
text: ":warning: *npm packument for `renovate` is getting large*: ${{ steps.check.outputs.size-mb }} MB across ${{ steps.check.outputs.version-count }} versions. Warning threshold is 85 MB, npm rejects publishes at 100 MB.\nhttps://registry.npmjs.org/renovate"
62+
blocks:
63+
- type: "section"
64+
text:
65+
type: "mrkdwn"
66+
text: ":warning: *npm packument for `renovate` is getting large*: ${{ steps.check.outputs.size-mb }} MB across ${{ steps.check.outputs.version-count }} versions. Warning threshold is 85 MB, npm rejects publishes at 100 MB.\nhttps://registry.npmjs.org/renovate"
67+
68+
- name: Post critical warning to Slack
69+
if: steps.check.outputs.status == 'critical'
70+
uses: slackapi/slack-github-action@0d95c9a7becc1e6e297d76df9bc735c44f4cbcbc # v3.0.5
71+
with:
72+
webhook: ${{ secrets.RENOVATEBOT_SLACK_WEBHOOK_MAIN_FAILURES }}
73+
webhook-type: incoming-webhook
74+
payload: |
75+
text: ":rotating_light: *npm packument for `renovate` is close to the 100 MB publish limit*: ${{ steps.check.outputs.size-mb }} MB across ${{ steps.check.outputs.version-count }} versions. Publishing will start failing soon - action needed.\nhttps://registry.npmjs.org/renovate"
76+
blocks:
77+
- type: "section"
78+
text:
79+
type: "mrkdwn"
80+
text: ":rotating_light: *npm packument for `renovate` is close to the 100 MB publish limit*: ${{ steps.check.outputs.size-mb }} MB across ${{ steps.check.outputs.version-count }} versions. Publishing will start failing soon - action needed.\nhttps://registry.npmjs.org/renovate"
81+
82+
- name: Fail job if size is critical
83+
if: steps.check.outputs.status == 'critical'
84+
run: exit 50

0 commit comments

Comments
 (0)