3131 uses : namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0
3232 with :
3333 cache : rust
34- path : |-
35- /home/runner/.cache/sccache
36- /nix
34+ path : /nix
3735 continue-on-error : true
3836 - name : Setup Nix
3937 uses : ' ./.github/actions/setup-nix'
@@ -42,10 +40,34 @@ jobs:
4240 with :
4341 cachix-auth-token : ${{ secrets.CACHIX_AUTH_TOKEN }}
4442 dev-shell : ' true'
45- - name : Point sccache at the cache volume
43+ - name : Configure Namespace remote sccache
44+ if : (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || github.event.pull_request.head.repo.full_name == github.repository
4645 run : |-
47- echo "SCCACHE_DIR=/home/runner/.cache/sccache" >> "$GITHUB_ENV"
48- echo "SCCACHE_CACHE_SIZE=20G" >> "$GITHUB_ENV"
46+ set -euo pipefail
47+ env_file="$(mktemp "$RUNNER_TEMP/namespace-sccache.XXXXXX")"
48+ trap 'rm -f "$env_file"' EXIT
49+ if nsc cache sccache setup --cache_name sccache-ci > "$env_file"; then
50+ # Register credential values as masked BEFORE exporting: GitHub only
51+ # masks `secrets.*`, so without this SCCACHE_WEBDAV_TOKEN — a broad,
52+ # ~24h Namespace workspace token (registry + cache write) — printed
53+ # verbatim in every subsequent step's env dump. Masking is selective by
54+ # key name: masking non-secrets like the endpoint URL or key prefix
55+ # would redact those strings everywhere in the logs.
56+ while IFS= read -r line; do
57+ k="${line%%=*}"
58+ v="${line#*=}"
59+ [ -n "$v" ] && [ "$k" != "$line" ] || continue
60+ case "$k" in
61+ *TOKEN*|*SECRET*|*PASSWORD*) echo "::add-mask::$v" ;;
62+ esac
63+ done < "$env_file"
64+ cat "$env_file" >> "$GITHUB_ENV"
65+ # Force the next compiler invocation to start a server with the new remote
66+ # backend even if a setup hook happened to launch one already.
67+ sccache --stop-server >/dev/null 2>&1 || true
68+ else
69+ echo "::warning::Namespace remote sccache setup failed; using local cache fallback"
70+ fi
4971 - name : install tool
5072 run : cargo install cargo-workspace-dependency-checker@1.0.1
5173 - name : check
6587 uses : namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0
6688 with :
6789 cache : rust
68- path : |-
69- /home/runner/.cache/sccache
70- /nix
90+ path : /nix
7191 continue-on-error : true
7292 - name : Setup Nix
7393 uses : ' ./.github/actions/setup-nix'
@@ -76,10 +96,34 @@ jobs:
7696 with :
7797 cachix-auth-token : ${{ secrets.CACHIX_AUTH_TOKEN }}
7898 dev-shell : ' true'
79- - name : Point sccache at the cache volume
99+ - name : Configure Namespace remote sccache
100+ if : (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || github.event.pull_request.head.repo.full_name == github.repository
80101 run : |-
81- echo "SCCACHE_DIR=/home/runner/.cache/sccache" >> "$GITHUB_ENV"
82- echo "SCCACHE_CACHE_SIZE=20G" >> "$GITHUB_ENV"
102+ set -euo pipefail
103+ env_file="$(mktemp "$RUNNER_TEMP/namespace-sccache.XXXXXX")"
104+ trap 'rm -f "$env_file"' EXIT
105+ if nsc cache sccache setup --cache_name sccache-ci > "$env_file"; then
106+ # Register credential values as masked BEFORE exporting: GitHub only
107+ # masks `secrets.*`, so without this SCCACHE_WEBDAV_TOKEN — a broad,
108+ # ~24h Namespace workspace token (registry + cache write) — printed
109+ # verbatim in every subsequent step's env dump. Masking is selective by
110+ # key name: masking non-secrets like the endpoint URL or key prefix
111+ # would redact those strings everywhere in the logs.
112+ while IFS= read -r line; do
113+ k="${line%%=*}"
114+ v="${line#*=}"
115+ [ -n "$v" ] && [ "$k" != "$line" ] || continue
116+ case "$k" in
117+ *TOKEN*|*SECRET*|*PASSWORD*) echo "::add-mask::$v" ;;
118+ esac
119+ done < "$env_file"
120+ cat "$env_file" >> "$GITHUB_ENV"
121+ # Force the next compiler invocation to start a server with the new remote
122+ # backend even if a setup hook happened to launch one already.
123+ sccache --stop-server >/dev/null 2>&1 || true
124+ else
125+ echo "::warning::Namespace remote sccache setup failed; using local cache fallback"
126+ fi
83127 - name : generated dependency artifacts are up to date
84128 run : |
85129 cargo run -p xtask --locked -- deps --check
0 commit comments