Skip to content

Commit 9fd25af

Browse files
committed
use credential.helper
1 parent 2e1f8ab commit 9fd25af

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/templates/.README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,7 @@ This will use a lot of minutes on GitHub-hosted runners, so you may want to use
4949
This is an example for `systemd`; adapt it to your needs. Please note:
5050

5151
- Docker needs to be installed
52-
- You don't need to set `GITHUB_TOKEN` if you first log in with `gh` or use your PAT to run:
53-
54-
```bash
55-
git clone --depth=1 -b <GITHUB_BRANCH> --single-branch [https|ssh]://<PAT>@github.com/<GITHUB_OWNER>/<GITHUB_REPO> /opt/<GITHUB_REPO>/<GITHUB_BRANCH>
56-
```
57-
52+
- You don't need to set `GITHUB_TOKEN` if you first log in with `gh`
5853
- `-m 0` ensures only the public packages of the owners you've added are updated (default)
5954
- You'll need the proper permissions to update private packages
6055
- `-d 0` allows everything to be updated in one go

src/test/update.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
root="$1"
99
[[ -n "$root" && ! "${root:0:2}" =~ -(m|d) ]] && shift || root="."
1010
[ -d "$root" ] || mkdir -p "$root"
11-
[ -d "$root/.git" ] || { gh auth status &>/dev/null && gh repo clone "${GITHUB_OWNER:-ipitio}/${GITHUB_REPO:-backage}" "$root" -- --depth=1 -b "$GITHUB_BRANCH" --single-branch || git clone --depth=1 -b "$GITHUB_BRANCH" --single-branch "https://$([ -n "$GITHUB_TOKEN" ] && echo "$GITHUB_TOKEN@" || echo "")github.com/${GITHUB_OWNER:-ipitio}/${GITHUB_REPO:-backage}.git" "$root"; }
11+
[ -d "$root/.git" ] || { gh auth status &>/dev/null && gh repo clone "${GITHUB_OWNER:-ipitio}/${GITHUB_REPO:-backage}" "$root" -- --depth=1 -b "$GITHUB_BRANCH" --single-branch || git clone --depth=1 -b "$GITHUB_BRANCH" --single-branch "https://github.com/${GITHUB_OWNER:-ipitio}/${GITHUB_REPO:-backage}.git" "$root"; }
1212

1313
# actions: move db into root
1414
shopt -s dotglob
@@ -24,17 +24,16 @@ popd || exit 1
2424
[ -n "$GITHUB_TOKEN" ] || GITHUB_TOKEN=$(if git config --get remote.origin.url | grep -q '@'; then grep -oP '(?<=://)[^@]+'; else echo ""; fi)
2525
[ -n "$GITHUB_TOKEN" ] || ! gh auth status &>/dev/null || GITHUB_TOKEN=$(gh auth token)
2626
[ -n "$GITHUB_ACTOR" ] || GITHUB_ACTOR="${GITHUB_OWNER:-ipitio}"
27-
git config --global user.name "${GITHUB_ACTOR}"
28-
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
29-
git config --global --get-regexp --name-only '^url\.https://.+\.insteadof' | xargs -n1 git config --unset-all 2>/dev/null
30-
git config --global url.https://"${GITHUB_TOKEN}"@github.com/.insteadOf https://github.com/
31-
git config --global --add safe.directory "$(pwd)"
32-
git config --global core.sharedRepository all
27+
git config user.name "${GITHUB_ACTOR}"
28+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
29+
git config credential.helper "!f() { echo username=${GITHUB_ACTOR}; echo password=${GITHUB_TOKEN}; }; f"
30+
git config --add safe.directory "$(pwd)"
31+
git config core.sharedRepository all
3332

3433
# performance
35-
git config --global core.fsmonitor true
36-
git config --global core.untrackedcache true
37-
git config --global feature.manyFiles true
34+
git config core.fsmonitor true
35+
git config core.untrackedcache true
36+
git config feature.manyFiles true
3837
git update-index --index-version 4
3938

4039
sudonot chmod -R a+rwX .

0 commit comments

Comments
 (0)