Unset GITEA_NPM_TOKEN environment variable before reading files

Ensure script always uses token from files instead of inherited
environment variable which may contain stale values.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
root 2026-05-12 05:17:58 +00:00
parent 08a617a94e
commit 53db0c7847

View File

@ -232,7 +232,9 @@ else
fi fi
# Resolve Gitea npm token for BuildKit secret # Resolve Gitea npm token for BuildKit secret
if [ -z "${GITEA_NPM_TOKEN:-}" ]; then # Unset any existing environment variable to ensure we use file values
unset GITEA_NPM_TOKEN
if [ -f "/opt/bytelyst/.gitea_token" ]; then if [ -f "/opt/bytelyst/.gitea_token" ]; then
GITEA_NPM_TOKEN=$(cat /opt/bytelyst/.gitea_token) GITEA_NPM_TOKEN=$(cat /opt/bytelyst/.gitea_token)
export GITEA_NPM_TOKEN export GITEA_NPM_TOKEN
@ -242,7 +244,6 @@ if [ -z "${GITEA_NPM_TOKEN:-}" ]; then
else else
fail "GITEA_NPM_TOKEN not set and no token file found" fail "GITEA_NPM_TOKEN not set and no token file found"
fi fi
fi
# Collect build metadata (consumed by @bytelyst/devops) # Collect build metadata (consumed by @bytelyst/devops)
# Declare separately so set -e + $(…) don't mask non-zero exit codes (SC2155). # Declare separately so set -e + $(…) don't mask non-zero exit codes (SC2155).