Skip to content

Commit 8043a6d

Browse files
cipolleschimeta-codesync[bot]
authored andcommitted
Validate NPM token before nightly publish (#56502)
Summary: Pull Request resolved: #56502 Adds an NPM token validation step to the `build_npm_package` job of the React Native nightly workflow. Mirrors the same check we recently added to `create-release.yml` and the Hermes `rn-build-hermes.yml` workflows so we fail fast (with a clear message) instead of failing partway through the publish step when the token is expired or missing. ## Changelog: [Internal] - Reviewed By: fabriziocucci Differential Revision: D101594276 fbshipit-source-id: bb0fbddf5eba921f4184117dc29c7cc9e911a00e
1 parent 0223364 commit 8043a6d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

.github/workflows/nightly.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ jobs:
8989
steps:
9090
- name: Checkout
9191
uses: actions/checkout@v6
92+
- name: Verify NPM token
93+
run: |
94+
if [[ -z "$GHA_NPM_TOKEN" ]]; then
95+
echo "⚠️ No NPM token found. Skipping validation."
96+
exit 0
97+
fi
98+
echo "//registry.npmjs.org/:_authToken=$GHA_NPM_TOKEN" > ~/.npmrc
99+
if ! npm whoami > /dev/null 2>&1; then
100+
echo "❌ NPM token is invalid or expired. Aborting release."
101+
exit 1
102+
fi
103+
echo "✅ NPM token is valid ($(npm whoami))"
104+
rm -f ~/.npmrc
92105
- name: Build and Publish NPM Package
93106
uses: ./.github/actions/build-npm-package
94107
with:

0 commit comments

Comments
 (0)