Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 17 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -479,30 +479,24 @@ jobs:
[ -n "$NODE_AUTH_TOKEN" ] || { echo "Error: NPM_TOKEN is not set."; exit 1; }
WHO="$(npm whoami)"
echo "npm identity: $WHO"
npm access list packages --json > access.json
node -e '
const a = require("./access.json");
const need = ["node","web","cli","edge","ssr","react-native"].map((p) => "@checkgate/" + p);
const bad = need.filter((p) => a[p] !== "read-write");
for (const p of need) console.log(` ${p}: ${a[p] ?? "no access"}`);
if (bad.length) { console.error("Error: no read-write access to " + bad.join(", ")); process.exit(1); }
'
# The new packages (openfeature-provider, node-integrations,
# mcp-server) are created by their first publish. Org members of
# any role may create packages in the org scope; a granular token
# must also cover the @checkgate scope, not only listed packages.
if npm org ls checkgate "$WHO" --json > role.json 2>/dev/null; then
echo "role in the checkgate org: $(node -p 'Object.values(require("./role.json"))[0] ?? "none"')"
else
echo "::warning::Could not read the checkgate org role (the token may lack organization read permission). Confirm on npmjs.com that this token's package scope includes @checkgate."
fi
for p in openfeature-provider node-integrations mcp-server; do
if npm view "@checkgate/$p" version >/dev/null 2>&1; then
echo " @checkgate/$p already exists: $(npm view @checkgate/$p versions --json | tr -d '\n ')"
else
echo " @checkgate/$p does not exist yet (its first publish creates it)"
fi
# Per-package collaborators: whether THIS identity may publish each
# package. (`npm access list packages` without a scope lists the
# user's own packages, which a granular token may not read: 403.)
# Every package exists since 0.2.0, so all nine are checked.
BAD=""
for p in node web cli edge ssr react-native openfeature-provider node-integrations mcp-server; do
ACCESS="$(npm access list collaborators "@checkgate/$p" --json | WHO="$WHO" node -e '
let b = ""; process.stdin.on("data", (d) => b += d).on("end", () => {
console.log(JSON.parse(b)[process.env.WHO] ?? "no access");
});')"
echo " @checkgate/$p: $ACCESS"
[ "$ACCESS" = read-write ] || BAD="$BAD @checkgate/$p"
done
if [ -n "$BAD" ]; then echo "Error: $WHO has no read-write access to:$BAD"; exit 1; fi
# A granular token can be limited to some packages or to read-only;
# that cannot be checked without publishing. Confirm on npmjs.com
# that the token has read and write on the @checkgate scope.
echo "::notice::Token scope cannot be verified without publishing: confirm on npmjs.com that NPM_TOKEN has read-write on @checkgate."

- name: pub.dev — credentials present and well-formed
env:
Expand Down
Loading