@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 03:37 UTC

main
yml 38 lines 1.59 KB
Raw
1 name: Drop checkout credentials
2 description: Removes the token actions/checkout leaves behind, so later steps can run dependency and build scripts.
3
4 # checkout keeps the token in a file under RUNNER_TEMP that .git/config includes, so
5 # both go. `persist-credentials: false` fails in this repo: its cleanup runs `git
6 # submodule foreach`, which stops at the vendored gitlinks under .repos (no .gitmodules).
7 runs:
8 using: composite
9 steps:
10 - name: Drop checkout credentials
11 shell: bash
12 run: |
13 # Status 1 means no match; any other failure stops the step.
14 lookup() {
15 local status=0
16 git -C "$dir" config --local "$@" || status=$?
17 if [ "$status" -gt 1 ]; then exit "$status"; fi
18 }
19 for dir in . .trusted; do
20 [ -e "$dir/.git" ] || continue
21 lookup --get-regexp '^includeif\..*\.path$' | while read -r key file; do
22 rm -f "$file"
23 git -C "$dir" config --local --unset-all "$key"
24 done
25 lookup --name-only --get-regexp '^http\..*\.extraheader$' | while read -r key; do
26 git -C "$dir" config --local --unset-all "$key"
27 done
28 remaining="$(lookup --get-regexp 'extraheader|includeif')"
29 if [ -n "$remaining" ]; then
30 echo "::error::checkout credentials are still configured in $dir"
31 exit 1
32 fi
33 done
34 rm -f "$RUNNER_TEMP"/git-credentials-*.config
35 if ls "$RUNNER_TEMP"/git-credentials-*.config 2>/dev/null; then
36 echo "::error::a checkout credential file is still present"
37 exit 1
38 fi