forker
This commit is contained in:
1 parent
cd23a46923
commit
194a20a333
4 files changed
+27
-2
No files matched your search
+1
-1
@@ -29,7 +29,7 @@ on_new_tag: true
|
||||
|
||||
# Also mirror the upstream's existing releases (metadata + assets) via the
|
||||
# provider API (true/false). Default: false
|
||||
mirror_upstream_releases: false
|
||||
mirror_upstream_releases: true
|
||||
|
||||
# Build commands run inside the tag's working tree to produce release assets.
|
||||
# Multiple commands are ';'-separated. Leave empty to skip the local build and
|
||||
|
||||
@@ -46,7 +46,13 @@ In the Gitea UI: **this repo → Fork** → name it after the upstream
|
||||
### 2. Point it at the upstream (the "remote")
|
||||
In the fork: **Settings → Actions → Variables & Secrets**
|
||||
- **Variable** `UPSTREAM_URL` = `https://github.com/owner/repo.git` (any provider)
|
||||
- **Secret** `UPSTREAM_TOKEN` = a token that can read that upstream
|
||||
- **Secret** `UPSTREAM_TOKEN` = *(optional — only for private upstreams.)*
|
||||
Public upstreams are mirrored **anonymously** and the tool never
|
||||
authenticates against them: the global/system git config and the
|
||||
credential helper are cut for all upstream git calls, so a stored
|
||||
`~/.git-credentials` entry is never used. Only set a token when the
|
||||
upstream is private (or you need a higher API rate for mirrored
|
||||
releases).
|
||||
|
||||
Everything non-secret (which branches, how often, build command, artifacts) lives
|
||||
in **`.forker.yaml`** — edit it in the UI on the `forker` branch.
|
||||
|
||||
@@ -29,6 +29,14 @@ GITEA_REPO="${GITEA_REPO:?GITEA_REPO is required}"
|
||||
UPSTREAM_URL="${UPSTREAM_URL:-}"
|
||||
UPSTREAM_TOKEN="${UPSTREAM_TOKEN:-}"
|
||||
|
||||
# --- never touch stored git credentials (same hardening as sync.sh) ---------
|
||||
# All git calls here use explicit Bearer headers (fork build) or are
|
||||
# anonymous (upstream mirror via provider.sh). Cut global/system config and
|
||||
# the credential helper so a stored github.com entry can't be used silently.
|
||||
export GIT_CONFIG_GLOBAL=/dev/null
|
||||
export GIT_CONFIG_NOSYSTEM=1
|
||||
export GIT_CONFIG_SYSTEM=/dev/null
|
||||
|
||||
# REPO_ROOT = the forker-branch checkout (where the machinery lives). The build
|
||||
# runs inside $WORK (the tag's tree), but the build SCRIPT is resolved from here.
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
@@ -55,6 +55,17 @@ mkdir -p "$MIRROR_DIR"
|
||||
# Fail fast instead of hanging on an interactive credential prompt.
|
||||
export GIT_TERMINAL_PROMPT=0
|
||||
|
||||
# --- upstream is ANONYMOUS by default (never touch stored credentials) ------
|
||||
# Public upstreams must be fetched without authenticating. Without this, a
|
||||
# `credential.helper=store` + a stored github.com entry would SILENTLY
|
||||
# authenticate the fetch with the operator's GitHub account. We cut the
|
||||
# global/system git config and the credential helper for ALL upstream git
|
||||
# calls (env-scoped, does not affect the fork push below, which uses its own
|
||||
# explicit Bearer header). Private upstreams opt in via UPSTREAM_TOKEN.
|
||||
export GIT_CONFIG_GLOBAL=/dev/null
|
||||
export GIT_CONFIG_NOSYSTEM=1
|
||||
export GIT_CONFIG_SYSTEM=/dev/null
|
||||
|
||||
# --- ensure the bare mirror exists -------------------------------------------
|
||||
if [ ! -f "$MIRROR_DIR/HEAD" ]; then
|
||||
echo ">> Initializing bare mirror for $UPSTREAM_URL"
|
||||
|
||||
Reference in new issue
Block a user