ci: a pull request runs the tests and fails while a package in it isn't on npm yet (#52)
Trusted publishing can't create a package, so #39's block-patterns, merged before its first version was on npm, left every publish run on main red after it (8 runs, the last 37781353941), and a real refused publish would have hidden behind it. pr.yml runs bun test and check.mjs on each pull request, and scripts/new-to-npm.sh names any package npm doesn't know, so its first version is published by hand and its Trusted Publisher set before the merge. The README's market section says so. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f4c0d96c9c
commit
2b0b2d9401
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# Fails, naming them, when a package here has never been published to npm.
|
||||
# Trusted publishing can't create a package, so one merged before its first
|
||||
# version is on npm leaves every publish run on main red until someone
|
||||
# publishes it by hand (scripts/publish.sh <otp>) and sets publish.yml as
|
||||
# its Trusted Publisher on npmjs.com. A pull request runs this, so that is
|
||||
# done before the merge, not found after.
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
export npm_config_registry=https://registry.npmjs.org
|
||||
for dir in packages/*/; do
|
||||
name=$(node -p "require('./${dir}package.json').name")
|
||||
if [ "$(npm view "$name" name 2>/dev/null)" != "$name" ]; then
|
||||
echo "::error file=${dir}package.json::$name is not on npm yet, and trusted publishing can't create it. Before this is merged, a magpie-community npm owner publishes its first version by hand (scripts/publish.sh <otp>) and sets .github/workflows/publish.yml as its Trusted Publisher on npmjs.com; then re-run this check."
|
||||
new="$new $name"
|
||||
fi
|
||||
done
|
||||
if [ -n "$new" ]; then
|
||||
echo "new to npm:$new"
|
||||
exit 1
|
||||
fi
|
||||
echo "every package is on npm"
|
||||
Reference in New Issue
Block a user